Who is calling?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there an easy way to get the URL that is used in a debugging session in
Visual Studo 2005?
I tried request.ServerVariable("REMOTE_PORT") but it returns blank and not
the port used.
The request.ServerVariable("SERVER_NAME") works OK, but I don't have the
whole URL.
 
Try REMOTE_HOST and see if that doesn't do it for you.

You also might want to look at the Request.Url property.

Peter
 
Request.Url is your friend. You'll find things like Request.Url.Authority
(which is what you want I think) and much more.

Karl
 
There are several values within the Request.URL object that you can use. Try
Request.URL.AbsolutePath or Request.URL.AbsoluteURL or Request.URL.LocalPath.
 
Phillip,
The request.URL is useful. When I run in a file-based Web project in Visual
Studio 2005 I get an extra folder name on the URL which is my project name.
This causes me problems. I wonder if switching to a web-base project would be
better.

Arne
 
Karl,
The request.URL is useful. When I run in a file-based Web project in Visual
Studio 2005 I get an extra folder name on the URL which is my project name.
This causes me problems. I wonder if switching to a web-base project would be
better.

Arne
 
Hi Arne,

Try something like this:
if (Reuqest.Url.Port >0) //this is the case when vs2005 debugs a
file-based project
{
//this should strip off the project name and gets you only the path and
page name
string myUrl =
Request.Url.LocalPath.Replace(Request.Url.Segments[1],"");
}
 
Correction:

The condition for checking is Port !=80

if (Reuqest.Url.Port!=80) {}


Phillip Williams said:
Hi Arne,

Try something like this:
if (Reuqest.Url.Port >0) //this is the case when vs2005 debugs a
file-based project
{
//this should strip off the project name and gets you only the path and
page name
string myUrl =
Request.Url.LocalPath.Replace(Request.Url.Segments[1],"");
}
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


Arne said:
Phillip,
The request.URL is useful. When I run in a file-based Web project in Visual
Studio 2005 I get an extra folder name on the URL which is my project name.
This causes me problems. I wonder if switching to a web-base project would be
better.

Arne
 

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

Back
Top