.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

file extension problem

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :SharePoint

I try to upload  .mdb file to wss 3.0 and get an error message. When I go to Central  Administration - Operations - Blocked files type, I can delete the extension from the list, but I cannot click ok - the change doesn't stay.  Please, help



View Complete Post

More Related Resource Links

While Importing Excel 2007 file to Datatable - headerrow problem


Hi there,


I am trying to simply extract an excel data from an uploaded file an put it into a datatable. In this case the excel file has 3 rows but when I fill the datatable I only see row count of 2.

I tried changing HDR:NO; to HDR:YES and vice versa, but no luck. 

What am I doing wrong? (Note: the excel file cannot have a  headerrow)


string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pFilePath + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR:NO;\"";
            OleDbConnection conn = new OleDbConnection(connstr);
            DataTable dtTables = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
            string strTablename = dtTables.Rows[0]["TABLE_NAME"].ToString();
            string strSQL = "SELECT * FROM [" + strTablename + "]";

            OleDbCommand cmd = new OleDbCommand(strSQL, conn);

            DataTable dt = new DataTable();
            OleDbDataAdapter da = new OleDbDataAdapter(cmd);
            //At this point row count=2 which doesn't make sense




Problem in accessing resource file dynamically.


Steps I have followed are
1.I have created myres.en-GB.resx file at C:.
2.then created locale specific myres.en-GB.resources using resgen at c: only,
resgen c:\myres.en-GB.resx
3.Linked the Resource File to Assembly using AL.exe which is giving me assembly at c: only.
Al /t:lib /embed:myres.en-GB.resources /out:ClassLibrary1.dll
4.I have created one web application using vs 2008 & then build it.
5.Then placed both resource file & dll in web applications Bin\en-GB folder.
6.Anf finally written code at page load like
 CultureInfo info = new CultureInfo("en-GB");
            Thread.CurrentThread.CurrentCulture = info;
            Assembly asd = Assembly.Load("ClassLibrary1");
            ResourceManager res = new ResourceManager("myres.en-GB", asd.GetSatelliteAssembly(info));
            string sdf = res.GetString("Lab1");

but after running application I m getting following error
MissingManifestResourceException", "Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Cla

File Download Problem


Hi everyone,

I am using a download handler to handle the downloading of files from my website.  I am using a slightly modified code from the Microsoft article http://support.microsoft.com/kb/812406

Everything is working fine and downloading, even with large files, but it does not show the file size for any of the files to download. Even if theyre really small.

Here is my code for the handler

public class DownloadHandler : IHttpHandler

        public void ProcessRequest(HttpContext context)
            string path = "";
                path = context.Server.UrlDecode(context.Request.QueryString["src"]).DecryptString();
            catch(Exception ex)
            System.IO.Stream iStream = null;

            byte[] buffer = new Byte[10000];

            int length;

            long dataToRead;

            string filename = System.IO.Path.GetFileName(path);

                iStream = new System.IO.FileStream(context.Server.MapPath("~/" + path), System.IO.FileMode.Open,
                            System.IO.FileAccess.Read, System.IO.FileShare.Read);


Problem download file from SQL Server


Hello everyone. I am having an issue downloading files that I have store in SQL Server. I have no problem in a WinForm. What am I doing wrong in my code?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim sch As New clsReport
        Dim fileData As New clsReport.Letter
        fileData = sch.DownloadLetter(Session("LetterID"))
        Dim ms As System.IO.MemoryStream = fileData.fil

        Dim fil As Byte() = ms.ToArray
        Dim nam As String = fileData.name
        Dim ext As String = fileData.ext
        If Not fil Is Nothing Then
                ' Response.Clear()
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + nam & "." & ext)
                ' Response.AddHeader("Content-Disposition", nam & "." & ext)
                Response.AddHeader("Content-Length", fil.Length.ToString)
                Response.ContentType = "Application/octet-stream"
                Response.Buffer = True
            Catch ex As Exception
            End Try

        End If

    End Su

reading excel file problem



i have 200 rows in my excel file. im using OleDbConnection to read the excel file.

The problem is that it will read all the blank rows from row 200 onwards. Is there a configuration im missing ? or is there a way to import all rows that has data? Here's some of my code.

string excelConnectionString =
               "Provider=Microsoft.Jet.OLEDB.4.0;" +
                "Data Source=" + filePath + ";" +
                "Extended Properties=Excel 8.0";

OleDbConnection excelConnection =
                    new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=NO'");

OleDbCommand cmd = new OleDbCommand("Select * from [list$]",excelConnection);

Generating MS Word doc from mht file gives smart quote problem


I have a word document to be generated using ASP.Net/VB.net.

So I have a word document template saved as .mht file on the web server.

In my ASP.Net code,I read this mht file content and replace certain string line Description$$ with the actual description from the database.Then save this content as .doc file.

This works fine but shows a box symbol when I have smart quotes " (not this one as I cannot type it here.The double quote which you see in MS Word,the slanted double quote).

I dont know how to make my word doc generated, show the exact double quote as in MS word.

If any of you have any idea of this please reply.

Thank you

Problem when using Activator.CreateObject and reading App.Config file

Hello, this is the scenario. I have an application that load at runtime severals dll. these dll are actually "adapters" that wraps calls to web services, database and so on. The app.config of the "main" application stores in config sections all information necessary to each adapter (i.e.Web ServiceURL..) and I have created inside each adapter a class to ready those values the loading at run time the DLL has been implemented by storing all necessary types into a dictionary of generics and when I need to instanciate it I call the Activate.CreateObject and I pass the specific type (I means the name of the Adapter class) The problem is that the adapter class itself is not able to get the config value because ConfigSection has not been initialized. If I write: IInterfaceAdap adapt = new myAdapter() -> I read the config data IInterfaceAdap adapt = (IInterfaceAdap)Activator.CreateObject (type) -> now way to read the data stored in the App.Config. I think that I undertood the problem but I'm not able to find a workaround to read data store in the app.config!! I need help please!!  

Web Folder problem : This file cannot be saved to this location because there is no connection to th

When I check out a Word 2007 document from a list, I cannot save it back to the server.  I get:   This file cannot be saved to this location because there is no connection to the server.  Check your network connection and try again.   I am using a Virtual Machine (Virtual PC).  I have the Microsoft Loopback adapter installed.    The server has a static IP address and is a domain controller. I am able to access the web folder through Windows Explorer.   How do I set up Office, Sharepoint and Webdav so that I can check files out of sharepoint and save them back, on a virtual machine?

File Upload Problem

I have a colleague that just cannot upload any files over 6mb to sharepoint. I have checked all his IE settings and everything is normal / the same as mine. anyone come across this before?Sharepoint Customiser

Upload large file via webservice problem in vb.net 1.1

Hi All, I am uploading large file via webservice using below my code in vb.net 1.1. Problem is vb.net 1.1 don't know Using Object loop. I would like to know any other loop similar Using loop to replace in vb.net 1.1Public Function UploadLargeFile(ByVal FileName As String, ByVal buffer As Byte(), ByVal Offset As Long) As Boolean Dim retVal As Boolean = False Try Dim FilePath As String = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory.ToString() & "\fpath\", FileName) If Offset = 0 Then File.Create(FilePath).Close() End If Using fs As New FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read) fs.Seek(Offset, SeekOrigin.Begin) fs.Write(buffer, 0, buffer.Length) End Using retVal = True Catch ex As Exception Throw ex End Try Return retVal End Function  

What registry keys are responsible for file extension association?

I'm trying to associate file extension to start some type of files with my application. Which registry keys I have to modify to be sure, that when user double click at file it opens with my application. And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"? This key created after setting default program by "Open with" dialog. I've tried: string ext=".eee"; RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext); RegistryPermission f = new RegistryPermission(RegistryPermissionAccess.Write, r.Name); f.Assert(); r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured

Problem with uploading a zip file containing xls with macros

I am getting the following error when I try to upload a zip file containing xls file with macros. The zip file size is 4 mb. However, we have SP 2010 environment (ready to be deployed in couple of months) and it works there. So, it is not to do with the file. I am not sure if SP 2007 has any limitations/restrictions with .xlsm files. How do I fix this issue ? "GILA_Reports_File_byGTStar_9_2010.zip" contains the following virus: "Large uncompressed size; Tagged ID: C57E7332_69BC_484A_B087_DB04D574CDC4" . This file cannot be saved to the document library. If you want to save this file to the document library, clean the file using alternative virus scanning software and try saving it again.

Problem with MVC and Resource file Localization

 Hello, Having a bit of an issue trying to get localization to work with MVC. I have created a resource file Account.resx under App_GlobalResources which contains my localized strings. Within my view model I am referencing the resource string in the Dispay attribute. public class LogOnModel { [Required] [Display(Name = "USERNAME", ResourceType=typeof(Resources.Account))] public string UserName { get; set; } [Required] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [Display(Name = "Remember me?")] public bool RememberMe { get; set; } } However when I run app the following exception is displayed from my razor cshtml file.   Cannot retrieve property 'Name' because localization failed.  Type 'Resources.Account' is not public or does not contain a public static string property with the name 'USERNAME'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Cannot retrieve property 'Name' because localization failed.  Type 'Res

How to show link file extension (lnk) in Explorer

My folders normally shows the file name extension.  But I have a folder full of window links and DOS links. I'm sure that is not the correct termioligy but it is the best I can do. I think I'm talking about .lnk and maybe .pif files. Anyway, the extension do not show in the folder listings. Can I make them show?   Thanks  

problem with sitemap schema 'xsi:schemaLocation' in XML file creation

SqlConnection conn = new SqlConnection(connStr); conn.Open(); string sql = "select top 10 catnum,cast(case when isnull(onhand,0) < 5 then 0 else round((onhand/2),1) end as int) as onhand from dbo.V_OnHand with (nolock)"; SqlCommand cmd = new SqlCommand(sql, conn); XmlDocument doc = new XmlDocument(); XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "UTF-8", null); XmlElement rootNode = doc.CreateElement("inventory"); doc.InsertBefore(dec, doc.DocumentElement); rootNode.SetAttribute("xmlns", "http://seller.marketplace.tests.com/inventory/v1"); rootNode.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); rootNode.SetAttribute("xsi:schemaLocation", "http://sellersupport.domain.test.com/test1/s/schema/inventory/inventory-xml-feed-v1.xsd"); doc.AppendChild(rootNode); XmlElement fbm = doc.CreateElement("inventory"); doc.DocumentElement.PrependChild(fbm); SqlDataReader rdr1 = cmd.ExecuteReader(); while (rdr1.Read()) { XmlElement item = doc.CreateElement("item"); item.Set

Problem in downloading a file code.

hey dere, here is my code.....   void transfer() { string filePath = Server.MapPath("~/download"); string _DownloadableProductFileName = "mob.txt"; System.IO.FileInfo FileName = new System.IO.FileInfo(filePath + "\\" + _DownloadableProductFileName); FileStream myFile = new FileStream(filePath + "\\" + _DownloadableProductFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); string lastUpdateTiemStamp = File.GetLastWriteTimeUtc(filePath).ToString("r"); string _EncodedData = HttpUtility.UrlEncode(_DownloadableProductFileName, Encoding.UTF8) + lastUpdateTiemStamp; Response.Clear(); Response.Buffer = false; Response.AddHeader("Accept-Ranges", "bytes"); Response.AppendHeader("ETag", "\"" + _EncodedData + "\""); Response.AppendHeader("Last-Modified", lastUpdateTiemStamp); Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName.Name); Response.End(); Label1.Text = "hel"; } i have two problems in this code.First while running this code i dont get the file damaged or corrupt. Second problem is dat the code exits at Response.End() and doesnt execute d last line... 

Problem to open infopath form : The file cannot be opened because it is not a valid InfoPath form

Hi i have a winform app which host of infopath forms. form templates and data stores in database and when user want to open/edit an existing infopath form data, it must be extract from database, save on disk and then open it to display it in formControl. my problem is that when i open form data, after it has been extracted on disk, i got this error : InfoPath cannot open the following file: C:\Users\Hamed\Documents\Visual Studio 2008\Projects\InfopathFormTest2\InfopathFormTest2\bin\Debug\d00d73e8-cf5c-4b12-b9a6-591c4ade83aa.xml. The file cannot be opened because it is not a valid InfoPath form.  The processing instruction in the file is missing or invalid. here is my code : this._fullPath = System.IO.Path.Combine(Application.StartupPath, this._dataRow.FormID.ToString() + ".xml"); this._templatePath = System.IO.Path.Combine(Application.StartupPath, this._templateRow.TemplateID.ToString() + ".xsn");if (HelperClass.ExtractToDisc(_fullPath, ASCIIEncoding.Unicode.GetBytes(this._dataRow.FormContent))) { this.formControl1.Open(_fullPath); this.txtFormName.Text = this._dataRow.FormName; } where is my problem and how to solve this ? thanks in advancehttp://www.codeproject.com/KB/codegen/DatabaseHelper.aspx
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend