开发者

Trouble accessing network share from asp.net web form

开发者 https://www.devze.com 2023-02-24 04:30 出处:网络
I have an asp.net webform which will display a PDF file.This pdf is stored on a network share on another server.The share has read permissions for everyone.

I have an asp.net webform which will display a PDF file. This pdf is stored on a network share on another server. The share has read permissions for everyone.

When I try to reference like \\server\sharename\file.pdf I get the following error:

Server Error in '/NCLWeb' Application.

HTTP Error 400 - Bad Request.

I've also tried variation with "file://" in front, and reversing the slashes. What am I doing wrong?

How should I properly reference this?

EDIT: I am testing the code using Visual Studio's built in development server. Code usage includes:

Response.Redirect(@\\server\sharename\file.pdf开发者_运维技巧);

ShowPdf1.FilePath = @\\server\sharename\file.pdf;

Where ShowPdf1 is a control which I've used to display pdf's in a browser before.


I doubt that folder is a Virtual Directory. If you want to access any shared folder from your application you need to make a Virtual Directory of that Folder.


Asp.net worker process needs permission to read network resources

check out article on code project(it was written in 2007) but it has basics written down step by step. http://www.codeproject.com/KB/aspnet/UNC__Access_Network_file.aspx

here is KB from microsoft http://support.microsoft.com/kb/207671

hope it helps

0

精彩评论

暂无评论...
验证码 换一张
取 消