I am developing a web app for our company intranet. C# and ASP.NET
I am tring to upload a file to the server. The same server that is hosting the web app.
I am getting an unauthorized access error when I try to do the upload.
How can I go about giving users access to upload files to the server?
The server is right next to me and I have administrator access .... I just don't know where to go / what to do.
Thank you,
Tom
ERROR DETAILS:
Server Error in '/' Application.
--------------------------
----------
----------
----------
----------
----------
----
Access to the path 'C:\MMMMMMMMMMLLLLLLLLLLLL
LLLL - Copy.csv' is denied.
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.UnauthorizedAccessE
xception: Access to the path 'C:\MMMMMMMMMMLLLLLLLLLLLL
LLLL - Copy.csv' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 20: {
Line 21: string filename = FileUploadLeads.FileName;
Line 22: FileUploadLeads.SaveAs("C:
\\" + FileUploadLeads.FileName);
Line 23:
Line 24: if (FileUploadEvent != null)
Source File: c:\Inetpub\crm\crmcustomco
ntrols\Upl
oadLeads.a
scx.cs Line: 22
Stack Trace:
[UnauthorizedAccessExcepti
on: Access to the path 'C:\MMMMMMMMMMLLLLLLLLLLLL
LLLL - Copy.csv' is denied.]
System.IO.__Error.WinIOErr
or(Int32 errorCode, String maybeFullPath) +7714255
System.IO.FileStream.Init(
String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor
(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +61
System.IO.FileStream..ctor
(String path, FileMode mode) +55
System.Web.HttpPostedFile.
SaveAs(Str
ing filename) +99
System.Web.UI.WebControls.
FileUpload
.SaveAs(St
ring filename) +23
crmcustomcontrols_UploadLe
ads.Button
UploadFile
_Click(Obj
ect sender, EventArgs e) in c:\Inetpub\crm\crmcustomco
ntrols\Upl
oadLeads.a
scx.cs:22
System.Web.UI.WebControls.
Button.OnC
lick(Event
Args e) +111
System.Web.UI.WebControls.
Button.Rai
sePostBack
Event(Stri
ng eventArgument) +110
System.Web.UI.WebControls.
Button.Sys
tem.Web.UI
.IPostBack
EventHandl
er.RaisePo
stBackEven
t(String eventArgument) +10
System.Web.UI.Page.RaisePo
stBackEven
t(IPostBac
kEventHand
ler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePo
stBackEven
t(NameValu
eCollectio
n postData) +36
System.Web.UI.Page.Process
RequestMai
n(Boolean includeStagesBeforeAsyncPo
int, Boolean includeStagesAfterAsyncPoi
nt) +1565
--------------------------
----------
----------
----------
----------
----------
----
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082