473,386 Members | 1,741 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,386 software developers and data experts.

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 8414
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.googlegr oups.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.googlegr oups.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\wwwroot\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.googlegr oups.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\wwwroot\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.googlegr oups.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\wwwroot\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(Server.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*********************@v46g2000cwv.googlegro ups.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
Jeff,

Yes this is resolved, now I am getting different error
Logon failure: unknown user name or bad password.

May 1 '06 #11
Um, when. Details please.

<j_****@hotmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Jeff,

Yes this is resolved, now I am getting different error
Logon failure: unknown user name or bad password.

May 1 '06 #12
when I try to open the file
File.OpenText(Server.MapPath("MyFile.txt"))

May 1 '06 #13
How are you prompting users to log onto this site?

What user context are you running under? Is Anonymous turned on? What are
the permissions on this file and this directory?

You'll probably want to turn on Basic authentication

Jeff
<j_****@hotmail.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
when I try to open the file
File.OpenText(Server.MapPath("MyFile.txt"))

May 1 '06 #14
I am not sure if I can still post to this thread...
I was on vacation, and couldn't participate..
anyway
Anonymous is turned off.
DIgest authentication for Windows domain servers is selected.
Basic authentication is selected.
..Net Password authentication is not selected.
Permissions on the file:
Administrator (Domain\Administrator)
aspnet_wp account (computerName\ASPNET)
Authenticated Users
Everyone

May 10 '06 #15

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

Similar topics

4
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...
0
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...
2
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...
4
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...
0
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,...
3
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 ...
2
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...
1
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...
2
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...
7
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,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.