473,614 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5820
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*****@discus sions.microsoft .com> wrote in message
news:C6******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .com> wrote in message
news:C6******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .com> wrote in message
news:C6******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .com> wrote in message
news:C6******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .com> wrote in message
news:C6******** *************** ***********@mic rosoft.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
4597
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 properly to the cgi and users get the message from IE that it "Cannot find server: The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to...
10
3903
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 official doc: http://python.org/doc/2.4.1/lib/module-gzip.html but after a minute of scanning, please someone tell me what the fuck is it talking about?
5
3996
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 2000. Of course there were no modifications made to the queries and they noticed significant performance issues. They recently upgraded the application to Access XP expecting the newer version to provide performance benefits and now queries take...
3
9503
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 the end of this message is the inflate method this is where I get stuck I know that I need a byte array but because I am decompressing a string I have no idea of how big the byte array will need to be in the end (the inflate and deflate methods...
14
2171
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 processing on them. Secondly, My app will have to read these files over a
3
2459
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 downloading a large-ish email (about 10K). This happens about 50% of the time when trying to download a large email from my POP server. I've tried telnet'ing into the POP server and manually issuing commands, and it works perfectly --- the...
0
2234
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 computer, the problem comes when the file is in a network drive. The most amazing thing is that in one computer I can execute my .Net program without problems independently if the file is
3
2648
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 real problems with the ASP side of things. Timeline of events is as follows: 1) Added IIS (via Add/Remove Windows Components) on WinXP Pro machine (6
9
2402
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. Communications on the Windows PCs use a class derived from CAsyncSocket(). I have written client and server versions of my software for use on the appropriate PCs. I am also using communicating with a legacy DOS based system, with the software...
0
8182
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8130
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8279
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7093
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6088
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5540
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1425
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.