[thelist] (asp.net 1.1) Application Path weirdness

Anthony Baratta anthony at baratta.com
Fri Jul 6 12:56:21 CDT 2007

I'm assuming the / in front of the ? is a typo.

ApplicationPath is just that, where you have the dotNet Application root. One your local PC, that will be /somedir/file.ext, because the local IIS service can only have one virtual directory and that forces you do work in a sub-directory. I'm guessing that your remote server has only the ASPX code in it directly and not within a sub-directory - hence the lack of a path. 

That said, just putting the Application Path will not give you the server name. So you should have that too as part of your out put:

"http://" & 
HttpContext.Current.Request.ServerVariables("HOST_NAME") & "/"
HttpContext.Current.Request.ApplicationPath & 
& tbSearch.Value.ToString

-----Original message-----
From: "Tab Alleman" talleman at Lumpsum.com
Date: Fri, 06 Jul 2007 09:18:01 -0700
To: "Evolt Thelist \(E-mail\)" thelist at lists.evolt.org
Subject: [thelist] (asp.net 1.1) Application Path weirdness

> I have this line of code:
> Response.Redirect(HttpContext.Current.Request.ApplicationPath & "/ClaimantList.aspx?Submit=Search&ClaimantSearch=" & tbSearch.Value.ToString)
> It works fine on my localhost, but when I upload it to a webserver and hit it, it attempts to redirect to something like:
> http://claimantlist.aspx/?Submit=Search&ClaimantSearch=pa
> Why is it munging the URL like that?  It's hard to debug when it doesn't happen in debug mode.   grrrr... 

More information about the thelist mailing list