newbie asp.net project question...

G

Guest

I have a simple question. I created a new Web thru IIS (MyWeb) that points to c:\Inetpub\wwwroot\MyWeb
Then I created a new asp.net project in VS. The problem that I have is this: when I compile and run the project, it's link looks like this

http://localhost/MyWeb/Default.asp

which means that if in Default.aspx I put a link to "\login.aspx" for example, it will fail, because "\" is "/localhost/". I need to have the root represented by the entire link. Therefore "\login.aspx" should point to "http://localhost/MyWeb/login.aspx" instead of "http://localhost/login.aspx". If it doesnt how am I supposed to work on different projects?? If I need to work on 3 different sites I need each of them to have it's own root..

How can I do that? Thank you

andrew
 
J

Jodie Rapson

Hey Andrew,

Are you talking about Server.MapPath??

Jodie Rapson

Andrew Parks said:
I have a simple question. I created a new Web thru IIS (MyWeb) that points to c:\Inetpub\wwwroot\MyWeb.
Then I created a new asp.net project in VS. The problem that I have is
this: when I compile and run the project, it's link looks like this:
http://localhost/MyWeb/Default.aspx

which means that if in Default.aspx I put a link to "\login.aspx" for
example, it will fail, because "\" is "/localhost/". I need to have the root
represented by the entire link. Therefore "\login.aspx" should point to
"http://localhost/MyWeb/login.aspx" instead of
"http://localhost/login.aspx". If it doesnt how am I supposed to work on
different projects?? If I need to work on 3 different sites I need each of
them to have it's own root...
 
G

Guest

No, what I mean is, on my development machine the projects are arranged like this

http://localhost/MyWeb1/ (MyWeb1 is the virtual dir setup in IIS
http://localhost/MyWeb2/ (MyWeb2 is the virtual dir setup in IIS

So, to refer a file

http://localhost/MyWeb1/Default.asp

When I deploy the finalized web application on the web it will be something like this

http://some.server.com/Default.asp

If I put a link in Default.aspx that reads: href="\Login.aspx", it will work on the deployed version, as

http://some.server.com/Login.asp

exists, but on the development machine it will not work because it will point to

http://localhost/Login.aspx, instead of http//localhost/MyWeb1/Login.asp

This means that either I have to deploy it as http://some.server.com/MyWeb1/ (which is not cool at all) or I have to work with ALL my projects directly in the root, which again is not good..

How can I do this
than
 
J

Jodie Rapson

What are you using to develop? As using "/file.aspx" should work on both

server and dev machine.

Jodie Rapson

Andrew Parks said:
I have a simple question. I created a new Web thru IIS (MyWeb) that points to c:\Inetpub\wwwroot\MyWeb.
Then I created a new asp.net project in VS. The problem that I have is
this: when I compile and run the project, it's link looks like this:
http://localhost/MyWeb/Default.aspx

which means that if in Default.aspx I put a link to "\login.aspx" for
example, it will fail, because "\" is "/localhost/". I need to have the root
represented by the entire link. Therefore "\login.aspx" should point to
"http://localhost/MyWeb/login.aspx" instead of
"http://localhost/login.aspx". If it doesnt how am I supposed to work on
different projects?? If I need to work on 3 different sites I need each of
them to have it's own root...
 
G

Guest

I use VS2003 and Framework 1.1.

It doesn't work as you say. For instance if I have an image href = "\Images\image1.gif

If I place the file here: c:\Inetpub\wwwroot\MyWeb\Images\image1.gif, it doesnt work. But if I put it here

c:\Inetpub\wwwroot\Images\image1.gif it works.

This is all on the dev machine. This means that "\" = "c:\Inetpub\wwwroot" when I really need it to be "c:\Inetpub\wwwroot\MyWeb". However, after researching a little bit on the web it looks like what I want is not possible. This means that I can only work on 1 project at a time or combine ALL projects in "c:\Inetpub\wwwroot"...

:-
 
J

Jodie Rapson

What are you using to dev? As I have been doing this for a few years and

this "/page.aspx" should be fine for test and server.

Jodie

Andrew said:
No, what I mean is, on my development machine the projects are arranged like this:

http://localhost/MyWeb1/ (MyWeb1 is the virtual dir setup in IIS)
http://localhost/MyWeb2/ (MyWeb2 is the virtual dir setup in IIS)

So, to refer a file:

http://localhost/MyWeb1/Default.aspx

When I deploy the finalized web application on the web it will be something like this:

http://some.server.com/Default.aspx

If I put a link in Default.aspx that reads: href="\Login.aspx", it will
work on the deployed version, as:
http://some.server.com/Login.aspx

exists, but on the development machine it will not work because it will point to:

http://localhost/Login.aspx, instead of http//localhost/MyWeb1/Login.aspx

This means that either I have to deploy it as
http://some.server.com/MyWeb1/ (which is not cool at all) or I have to work
with ALL my projects directly in the root, which again is not good...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top