Click here to Skip to main content
15,662,484 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends,

I am getting the following problem while clicking on the download button of my ASP.Net (C#) application. Please help me.

Access 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.ComponentModel.Win32Exception: Access is denied

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) +625
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +60
SMARTERPSYSTEM.PL.eDMS.WorkFlow.eDMSReview.lnkDoc_Click(Object sender, EventArgs e) +166
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +143
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +148
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3619

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.81.0


What I have tried:

System.Diagnostics.Process.Start(filepath);

I have written the above code onclick event of the button, and also given all privilege to the folder to everyone. Still I am getting the error.

It is working when i run the code but when I deploy the published file on server the same error shows.
Posted
Updated 14-Feb-17 22:07pm

1 solution

You're trying to start a process of some kind which you can't do. Your .net code runs on the server and while developing on your local machine the server is also the client so your code appeared to do what you want (ie launch a task on the "client"), but when your code runs on a remote server then that is where the task is ran, not on the client.

You can't launch processes on the client for obvious reasons so you need to re-architect what it is you're trying to do.
 
Share this answer
 
Comments
srikanta mohanty 15-Feb-17 4:32am    
Thanks you for valued guidance. May I get some help of overcoming this issue?
F-ES Sitecore 15-Feb-17 4:40am    
You'd have to explain what it is you're trying to do, it might not be possible. For example you've mentioned downloads so if you're trying to save files on the client machine, or execute files on the client machine it's just never going to work.
srikanta mohanty 15-Feb-17 4:44am    
I need to download some files text or pdf files from server which are stored in a specified folder. It needs to be downloaded to client machine on click of the button.
F-ES Sitecore 15-Feb-17 4:55am    
Google "asp.net download file to client" for sample code. Note that you can only instigate the download (ie the client will get the "Open or Save As" dialog), you can't make them save it or make them save it to a specific location on their drive.
srikanta mohanty 15-Feb-17 4:57am    
Thank you very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900