473,803 Members | 2,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Virtual Directory.

Hi there,

I created virtual directory on IIS.
Alias Name = "ABC"
Then I created simple web site which has just one button.
When clicking on that button following code is executed:
Dim myFile As StreamReader = File.OpenText("/abc/MyFile.txt")
Dim line As String = myFile.ReadLine
Do While Not line Is String.Empty
Dim XXX As String = line
Loop
myFile.Close()

This is the error message I am getting:

Could not find a part of the path "C:\abc\MyFile. txt".

What am I doing wrong?

May 1 '06 #1
14 8444
Does the folder have access permissions for the ASP.NET worker process ?

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics. com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
<j_****@hotmail .com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
Hi there,

I created virtual directory on IIS.
Alias Name = "ABC"
Then I created simple web site which has just one button.
When clicking on that button following code is executed:
Dim myFile As StreamReader = File.OpenText("/abc/MyFile.txt")
Dim line As String = myFile.ReadLine
Do While Not line Is String.Empty
Dim XXX As String = line
Loop
myFile.Close()

This is the error message I am getting:

Could not find a part of the path "C:\abc\MyFile. txt".

What am I doing wrong?

May 1 '06 #2
You'll want to check out Server.MapPath

<j_****@hotmail .com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
Hi there,

I created virtual directory on IIS.
Alias Name = "ABC"
Then I created simple web site which has just one button.
When clicking on that button following code is executed:
Dim myFile As StreamReader = File.OpenText("/abc/MyFile.txt")
Dim line As String = myFile.ReadLine
Do While Not line Is String.Empty
Dim XXX As String = line
Loop
myFile.Close()

This is the error message I am getting:

Could not find a part of the path "C:\abc\MyFile. txt".

What am I doing wrong?

May 1 '06 #3
To Swanand Mokashi
How do I do it? I added aspwp user to that folder but problem is still
the same...
To Jeff
This is what I did:
Dim x As String = Server.MapPath( "/abc/MyFile.txt")
Then when I check x it is C:\Inetpub\wwwr oot\abc\myFile. txt...

May 1 '06 #4
> How do I do it? I added aspwp user to that folder but problem is still
the same...


Try IIS_WPG instead...
May 1 '06 #5
What is the operating system of your server ?

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics. com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
<j_****@hotmail .com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
To Swanand Mokashi
How do I do it? I added aspwp user to that folder but problem is still
the same...
To Jeff
This is what I did:
Dim x As String = Server.MapPath( "/abc/MyFile.txt")
Then when I check x it is C:\Inetpub\wwwr oot\abc\myFile. txt...

May 1 '06 #6
So that is the correct path then?

Is it working?

Jeff
<j_****@hotmail .com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
To Swanand Mokashi
How do I do it? I added aspwp user to that folder but problem is still
the same...
To Jeff
This is what I did:
Dim x As String = Server.MapPath( "/abc/MyFile.txt")
Then when I check x it is C:\Inetpub\wwwr oot\abc\myFile. txt...

May 1 '06 #7
I think it is because I can access this file from my browser
http://localhost/abc/myFile.txt

I am running WindowsXP

May 1 '06 #8
You want to do this:

File.OpenText(S erver.MapPath(" MyFile.txt"))

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"j_****@hotmail .com" wrote:
Hi there,

I created virtual directory on IIS.
Alias Name = "ABC"
Then I created simple web site which has just one button.
When clicking on that button following code is executed:
Dim myFile As StreamReader = File.OpenText("/abc/MyFile.txt")
Dim line As String = myFile.ReadLine
Do While Not line Is String.Empty
Dim XXX As String = line
Loop
myFile.Close()

This is the error message I am getting:

Could not find a part of the path "C:\abc\MyFile. txt".

What am I doing wrong?

May 1 '06 #9
So then you're ok, and this issue is closed?

<j_****@hotmail .com> wrote in message
news:11******** *************@v 46g2000cwv.goog legroups.com...
I think it is because I can access this file from my browser
http://localhost/abc/myFile.txt

I am running WindowsXP

May 1 '06 #10

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

Similar topics

4
3728
by: Mark Hoagland | last post by:
I've got a scenario with a web application where I must access the virtual directory being accessed from within the Application_OnStart event handler. Specifically, I have a series of IIS virtual directories which all point to the same set of ASP pages. However, since each virtual directory is a separate 'application', each has its own set data which must be cached. To detect which data must be cached for each virtual directory, I need to...
0
1388
by: Dwaine | last post by:
I got stumpped on this a while back and used a workaround that involved the "same local username/pwd on both servers" method. Now I'd like to find a cleaner method.... The setup: A webApp (lets say C:\WebApp\) with a subordinate virtual directory (./Images) using an UNC path (e.g. \\ImageServer\Images\ ) to a remote directory, using pre-defined credientials configured via IIS manager or directoryservices using UNCUserName and...
2
1881
by: Edward W. | last post by:
I wrote my web service and I have no problem browsing to the asmx file and seeing the public methods. I can even invoke them with no problem. But in my asp.net application I get this error message "The request failed with HTTP status 401: Access Denied. " BUT when I add this line to my code it works fine. gsdiApplication gsdiWebService = new gsdiApplication(); gsdiApplication.Credentials =...
4
2271
by: Martin | last post by:
Hi, I am getting an "Access Denied" error when attempting to browse asp.net pages. I have installed ASP.NET 1.1.4322 on a domain controller. The machine also has ASP.NET 1.0.3705 installed on it. The machine is win 2k server. IIS is installed. I have already run aspnet_regiis - i to reinstall the .net framework.
0
1786
by: Yogesh Pancholi | last post by:
For some unexplained reason, I am suddenly unable to browse to a virtual directory on my laptop. I have a number of sample websites to which I could happliy browse up until last week. As of Monday, if I browse to any of the sites, I get an HttpException saying "The directory does not exist or is not accessible because of security settings." I honestly have not changed anything at all. I have checked and re-checked that ASPNET indeed has...
3
7966
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images C:\Inetpub\wwwroot\RunReportASP is the directory of my virtual directory for my app. In it's properties I did check "Write" as a permission. What else do I need to do?
2
3912
by: Rose winsle | last post by:
Hi guys ... I just wanted to create virtual directory using VB.net . i can manage that ... when i create the virtual directory how can i set anonymous access off. following is my code ============== Dim IISSchema As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/Schema/AppIsolated")
1
3406
by: charlieruss | last post by:
Hello, My problem is as follows: I am using IIS 5.1 with .net 1.1 I have a shared folder on a different computer on our network which I want to add as a virtual directory on my computer so that I can use <!--#include virtual="virtualDirectoryName/someFile.html" --> So, the problem is that I can only gain access to this virtual folder from my asp page when i set impersonate="true" and set the explicit user to gain access to the virtual...
2
3390
by: charlieruss | last post by:
Hello, My problem is as follows: I am using IIS 5.1 with .net 1.1 I have a shared folder on a different computer on our network which I want to add as a virtual directory on my computer so that I can use <!--#include virtual="virtualDirectoryName/someFile.html" --> the problem is that I can only gain access to this virtual folder from my asp page when i set impersonate="true" and set the explicit user to gain access to the virtual...
7
1932
by: Fred | last post by:
I have a file (access.php) with the db username and pwd, which I include in every php file that needs db access. I'm not clear on how to set the path. I have an account on a shared *nix server, and this code will be in a subdomain (which is a subdirectory). Do I go upward with "../../access.php" or do I start with "/" and figure out where that actually is, then go downward?
0
9703
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
10555
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10300
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
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9127
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
7607
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
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4277
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
3
2974
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.