question

GaniTPT avatar image
0 Votes"
GaniTPT asked QiYou-MSFT answered

Access to the path is denied while downloading the file in ASPX

Access to the path is denied.

I am using simple aspx page for downloading the file and same will be hosting in IIS.

i am using below code.

APSX Page


<asp:TreeNode Text="T1" Value="T1">
<asp:TreeNode Text="S1" Value="S1">
<asp:TreeNode Text="WinFileExe" Value="WinFileExe" ></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>

ASPX.vb File


dim filename as string
filename = "\\winnet.winnq.intranet\CANADA\Check File\Exe\WinFileExe"
Response.ClearContent()
Response.AddHeader("Content-Disposition", "attachment; filename=" & filename)
Response.TransmitFile(filename) ==> getting error in Transmitfile
Response.Flush()

Getting Error Access to the path "\\winnet.winnq.intranet\CANADA\Check File\Exe\WinFileExe" is denied.

But, we have given the specific access to the folder and given all the asp.net authorized access.

still i am getting the error.

dotnet-aspnet-webpages
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

But, we have given the specific access to the folder and given all the asp.net authorized access.

Your response is too vague to understand what you're doing. Plus the path does not look like a file!

Typically the application pool that hosts the application uses a service account that has been granted proper rights to access what looks like a remote file share. Contact your system admin for assistance.

0 Votes 0 ·

1 Answer

QiYou-MSFT avatar image
0 Votes"
QiYou-MSFT answered

Hi @GaniTPT,
First of all , I think the reason is that your file permissions may not be set correctly.
The solution is as follows:
1.Right-click folder, Security, add IUSR and IIS_IUSRS Security Control permissions.
2.Right-click on the folder, General, to see if it is read-only. Remove the read-only property.
Second, it may be that your permissions to this application on IIS Manage are not given to all access users, you can right-click your program on IIS Manage to select identity and configure it. For more help with IIS Manage, you can check out the following documentation.
https://docs.microsoft.com/en-us/iis/get-started/getting-started-with-iis/getting-started-with-the-iis-manager-in-iis-7-and-iis-8

Best regards,
Qi You


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.