Virtual paths, IIS, .NET

B

Bryan Ax

I have a default web site in IIS, maps to http://localhost. From
Visual Studio, I create a new web application, save it to
http://localhost/myApplication.

In IIS, myApplication appears as a new application. Just as I would
expect. My understanding of IIS now is that if I reference a file from
within this application, as in.

/folder1/file1.aspx

this SHOULD start from the application root myApplication, NOT from
localhost. However, I'm getting the following error message on an
application.

"The virtual path '/CMS/Controls/CMS_footer.ascx' maps to another
application, which is not allowed."

Now, this path is WITHIN the application myApplication. So, why is it
trying to find it somewhere else? Is it that this application is
contained WITHIN the default web site, and that's causing it? Again,
my understanding is that since Visual Studio has created this as a
separate application, and since I can see it as a separate application
WITHIN Internet Services Manager, this should not be happening.
Obviously, I'm dumb and missing something. Can someone please
enlighten me?

As an interesting test...

From a page

http://localhost/MyApplication,

I tried to do a redirect like this.

this.Response.Redirect("/myFolder/myPage.aspx");

the end result I see in the browser is....

http://localhost/myFolder/myPage.aspx

So, either my understanding of virtual paths within applications is
way off, or something else.

Help.
 
J

John Saunders

You are mistaken about that URL. "/something" is a Root-Relative URL, not an
Application-Relative URL. For those, you can usually use "~/something", at
least in controls marked runat="server".

Of course, depending on your circumstances, you might be able to use a
relative URL (I don't know what adjective to use).
"something/something.else" is what I mean.
 

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

Top