I need Reply urgent

Posted by Dotnetfundakumar under ASP.NET AJAX on 9/4/2009 | Views : 1317 | Status : [Member] | Replies : 5
I am upload to the file following error comes how to rectify

my code like this
Fp1.SaveAs(Server.MapPath("123\" + Fp1.FileName))


Access to the path 'location\Test1.txt' 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.

Regards
Kumar



Responses

Posted by: Vuyiswamb on: 9/4/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day Dotnetfundakumar

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.


The Error is giving you a Solution :) Do as the Error tells you to do and your problem will be solved.

Thank you for Posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetfundakumar on: 9/4/2009 [Member] Starter

Up
0
Down
i need upload concept i select the file in fileupload control and click command button following error comes this action running to hosting place. error comes pl tell solution my code like this

Fp1.SaveAs(Server.MapPath("Test\" + Fp1.FileName))

resonse soon most urgent

Regards
Kumar

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 9/4/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Dotnetfundakumar Dont Panic , Just read what i wrote there for you. That is your Solution. The problem is not always the code.

Thank you for posting at Dotnetfunda
[Administrator]

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakhangarg on: 9/4/2009 [Member] [Moderator] Silver

Up
0
Down
Hi DitNetFundaKumar--

Yes, Vuyiswamb is right. problem is not always with the code.. your folder need to permission to write either its ok hosting server or local. so please add permissions..

Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rtpharry on: 9/4/2009 [Member] [MVP] Bronze

Up
0
Down
Hey,

Try this instead

Fp1.SaveAs(Server.MapPath("~/123/" + Fp1.FileName))




Server.MapPath maps a url to a file system path but from your snippet you have used path notation (forward slash) so I think you might have missed the concept of how it works.

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response