By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

problems reading network file from ASP .NET

P: n/a
I've written a simple ASP .NET web application that reads a text file and
displays it in the web browser. Works fine when reading a local path; but
fails with "can not find a part of the path", or "can not access network
file" when attemting to access a UNC network path. I am using IIS 6.0 on
Server 2003. SharePoint Portal Server is also installed on this server. I
have granted full access to 'everyone' on the network file. An equivalent
..NET desktop application reads the file fine.

This seems like a trival task. What am I missing?
Nov 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Try giving access specifically to your ASP.NET machine account, which by
default has less privilege than Everyone. Equivalent .NET app is fine because
it's not running under a least-privileged account.

Bill

"zxkuqyb" wrote:
I've written a simple ASP .NET web application that reads a text file and
displays it in the web browser. Works fine when reading a local path; but
fails with "can not find a part of the path", or "can not access network
file" when attemting to access a UNC network path. I am using IIS 6.0 on
Server 2003. SharePoint Portal Server is also installed on this server. I
have granted full access to 'everyone' on the network file. An equivalent
.NET desktop application reads the file fine.

This seems like a trival task. What am I missing?

Nov 19 '05 #2

P: n/a
The ASPNET user account that ASP.NET uses by default does not have network
permissions. Either give the account such network permissions (likely with
the help of your network administrator) or use impersonation to have it run
under a different user account that does have such permissions.
For testing purposes you can have it run under your personal user account.
Here's more info:
http://msdn.microsoft.com/library/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"zxkuqyb" <zx*****@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
I've written a simple ASP .NET web application that reads a text file and
displays it in the web browser. Works fine when reading a local path; but
fails with "can not find a part of the path", or "can not access network
file" when attemting to access a UNC network path. I am using IIS 6.0 on
Server 2003. SharePoint Portal Server is also installed on this server.
I
have granted full access to 'everyone' on the network file. An equivalent
.NET desktop application reads the file fine.

This seems like a trival task. What am I missing?

Nov 19 '05 #3

P: n/a
I am using impersonation, and exactly that seems to be the problem. If I set
identity impersonate to false, the files are read fine. Set to true, access
is denied. I went through and granted the approprite permissions to both the
IIS_WPG and the user accounts. Is there anything else that could be limiting
access?

"Steve C. Orr [MVP, MCSD]" wrote:
The ASPNET user account that ASP.NET uses by default does not have network
permissions. Either give the account such network permissions (likely with
the help of your network administrator) or use impersonation to have it run
under a different user account that does have such permissions.
For testing purposes you can have it run under your personal user account.
Here's more info:
http://msdn.microsoft.com/library/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"zxkuqyb" <zx*****@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
I've written a simple ASP .NET web application that reads a text file and
displays it in the web browser. Works fine when reading a local path; but
fails with "can not find a part of the path", or "can not access network
file" when attemting to access a UNC network path. I am using IIS 6.0 on
Server 2003. SharePoint Portal Server is also installed on this server.
I
have granted full access to 'everyone' on the network file. An equivalent
.NET desktop application reads the file fine.

This seems like a trival task. What am I missing?


Nov 19 '05 #4

P: n/a
OK, so then don't use impersonation.
Problem solved.
No?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"zxkuqyb" <zx*****@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
I am using impersonation, and exactly that seems to be the problem. If I
set
identity impersonate to false, the files are read fine. Set to true,
access
is denied. I went through and granted the approprite permissions to both
the
IIS_WPG and the user accounts. Is there anything else that could be
limiting
access?

Nov 19 '05 #5

P: n/a
If I didn't need to restrict access to the app on a per user basis, sure that
would solve the problem. Being that I do, it sure would be nice if
impersonation worked.

thanks

"Steve C. Orr [MVP, MCSD]" wrote:
OK, so then don't use impersonation.
Problem solved.
No?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"zxkuqyb" <zx*****@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
I am using impersonation, and exactly that seems to be the problem. If I
set
identity impersonate to false, the files are read fine. Set to true,
access
is denied. I went through and granted the approprite permissions to both
the
IIS_WPG and the user accounts. Is there anything else that could be
limiting
access?


Nov 19 '05 #6

P: n/a
Did you ever get resolution on this?

I am having a nearly identical problem. SharePoint development server,
running Windows 2003, trying to do a File.Exists on a file on the network
using a UNC path, and it returns false. On doing a File.OpenRead it says the
file does not exist which isn't true. The web.config already was setup for
Windows impersonation on the SharePoint dev server and that setting is what
it took to get it to work in a non-Sharepoint .NET app so it wouldn't use the
ASPNET credentials. Something is going on with SharePoint. Any ideas?

"zxkuqyb" wrote:
If I didn't need to restrict access to the app on a per user basis, sure that
would solve the problem. Being that I do, it sure would be nice if
impersonation worked.

thanks

"Steve C. Orr [MVP, MCSD]" wrote:
OK, so then don't use impersonation.
Problem solved.
No?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"zxkuqyb" <zx*****@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
I am using impersonation, and exactly that seems to be the problem. If I
set
identity impersonate to false, the files are read fine. Set to true,
access
is denied. I went through and granted the approprite permissions to both
the
IIS_WPG and the user accounts. Is there anything else that could be
limiting
access?


Nov 19 '05 #7

P: n/a
I had to use "basic authentication" to get the app to work.
Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.