Request.ApplicationPath (ASP.NET 1.1)

J

James

I have a testing/development environment and a production environment for an ASP.NET application.

The URLs end up being similar to the following:

http://www.whatever.com/folder/appname for development (running on IIS 5.1)
and
http://app.whatever.com/ for production (running on IIS 6.0)

Both applications presently contain the exact same folder/file structure. Everything is the same. For whatever sets of reasons, the following code is returning different results. On development, the behavior is expected, and the page is displayed

Response.Redirect(Request.ApplicationPath & "/whatever.aspx")

Deveopment - Redirects to http://www.whatever.com/whatever.aspx

Production - Redirects to http://whatever.aspx

....and we obviously have a problem. I'm probably missing something incredibly simple or my approach is flawed. Just curious what the solution is. Driving me nuts.

Thanks
 
K

Karl Seguin [MVP]

well...you are probably ending up with a //whatever.aspx but I'm surprised that you'd be getting http://whatever.aspx even if that's the case.

The quickest solution is to do:

Response.Redirect("~/whatever.aspx"); :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


I have a testing/development environment and a production environment for an ASP.NET application.

The URLs end up being similar to the following:

http://www.whatever.com/folder/appname for development (running on IIS 5.1)
and
http://app.whatever.com/ for production (running on IIS 6.0)

Both applications presently contain the exact same folder/file structure. Everything is the same. For whatever sets of reasons, the following code is returning different results. On development, the behavior is expected, and the page is displayed

Response.Redirect(Request.ApplicationPath & "/whatever.aspx")

Deveopment - Redirects to http://www.whatever.com/whatever.aspx

Production - Redirects to http://whatever.aspx

...and we obviously have a problem. I'm probably missing something incredibly simple or my approach is flawed. Just curious what the solution is. Driving me nuts.

Thanks
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top