J
jeff31162
Hi all
Using vs2003 and C# in a web app.
I want the user to be able to upload a file.
I have an htmlFileField (<input>) on my form.
Then in my C# codebehind, I use fileChooseHtml.PostedFile.FileName to get
the location of the file (the user chose) to read in.
Then I use the following code to actually read the file:
using (StreamReader sr = new StreamReader(@sFilePath))
{
String line;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
sReturnLine += line;
}
}
and I get the error:
System.UnauthorizedAccessException: Access to the path "C:\Documents blah
blah blah...
So, yes, I could give permissions to ASP.NET (I have done it on other
folders and the code works fine) but, am I going to have these same
permission issues when I put this on the web and a user wants to upload a
file from their PC?
I havent gotten that far and might as well find out now, if it is going to
break when I try to deploy it.
Thanks
Jeff
Using vs2003 and C# in a web app.
I want the user to be able to upload a file.
I have an htmlFileField (<input>) on my form.
Then in my C# codebehind, I use fileChooseHtml.PostedFile.FileName to get
the location of the file (the user chose) to read in.
Then I use the following code to actually read the file:
using (StreamReader sr = new StreamReader(@sFilePath))
{
String line;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
sReturnLine += line;
}
}
and I get the error:
System.UnauthorizedAccessException: Access to the path "C:\Documents blah
blah blah...
So, yes, I could give permissions to ASP.NET (I have done it on other
folders and the code works fine) but, am I going to have these same
permission issues when I put this on the web and a user wants to upload a
file from their PC?
I havent gotten that far and might as well find out now, if it is going to
break when I try to deploy it.
Thanks
Jeff