473,394 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

problems reading network file from ASP .NET

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
7 5808
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
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
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
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
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
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
I had to use "basic authentication" to get the app to work.
Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tyler Style | last post by:
Hullo - looking for a little advice here. I have a form on a page in one domain submitting to a cgi in another domain. Weirdly, on some Windows XP systems, a form on the page fails to submit/post...
10
by: Xah Lee | last post by:
today i need to use Python to decompress gzip files. since i'm familiar with Python doc and have 10 years of computing experience with 4 years in unix admin and perl, i have quickly located the...
5
by: Scott | last post by:
I have a customer that had developed an Access97 application to track their business information. The application grew significantly and they used the Upsizing Wizard to move the tables to SQL...
3
by: Nick | last post by:
I have found a class that compresses and uncompresses data but need some help with how to use part of it below is the deflate method which compresses the string that I pass in, this works OK. At...
14
by: Zahid | last post by:
Hi, What is a VDT file? How do I read a VDT file into my application? I know how to read text files etc but not VDT files. Im preparing in advance a prototype that read VDT files and does...
3
by: Alex Clark | last post by:
Hi All, I'm having some problems reading a network stream. I'm writing a lightweight POP client to handle a very specific task, but I keep unexpectedly reaching the end of the datastream when...
0
by: Sergistm | last post by:
Hello World, :D I have a problem that it is making me crazy, I hope you can help me. I'm trying to execute a .exe file with the Procces.Start, and there is no problem when the file is on my...
3
by: Newbie | last post by:
Hi All Trying to create a mini-ASP web dev with a couple of PCs at school. When the teachers are happy with the site on the LAN then going to upload it to the school site. Problem is having...
9
by: =?Utf-8?B?SG93YXJkIFNtaXRo?= | last post by:
I am using VC++ 6.0 (with SP5 installed). When using WinXP this is with SP2 installed. I am developing an instrumentation system comprising a set of networked PCs connected using TCP/IP TCP links....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.