Hello,
I am trying to read data from excel file and copy it to DB at run time for web. First of all Is it possible to do that? Second here is what I have so far and i'm gettting an access denied on file read.
string StrFileType = "";
string StrFileName = "";
StrFileType = File.PostedFile .ContentType;
StrFileName = File.PostedFile .FileName; //.Substring(File .PostedFile.Fil eName.LastIndex Of("\\") + 1) ;
if (StrFileType.To String() == "applicatio n/vnd.ms-excel")
{
StreamReader logFileStream = new StreamReader(ne w FileStream(StrF ileName, FileMode.Open, FileAccess.Read , FileShare.ReadW rite));
string test = logFileStream.R eadLine();
}
I get the following error:
Access to the path "C:\Documen ts and Settings\xyz\De sktop\abc.xls" is denied.
I am trying to read data from excel file and copy it to DB at run time for web. First of all Is it possible to do that? Second here is what I have so far and i'm gettting an access denied on file read.
string StrFileType = "";
string StrFileName = "";
StrFileType = File.PostedFile .ContentType;
StrFileName = File.PostedFile .FileName; //.Substring(File .PostedFile.Fil eName.LastIndex Of("\\") + 1) ;
if (StrFileType.To String() == "applicatio n/vnd.ms-excel")
{
StreamReader logFileStream = new StreamReader(ne w FileStream(StrF ileName, FileMode.Open, FileAccess.Read , FileShare.ReadW rite));
string test = logFileStream.R eadLine();
}
I get the following error:
Access to the path "C:\Documen ts and Settings\xyz\De sktop\abc.xls" is denied.
Comment