How can I get the name of my script?

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

Guest

I need to obtain the name of my aspx script from within the
script. I am developing a web counter, and I need to log
the visitors into a file which has the same basename as the
script?
Thanks.
 
One option is Request.ServerVariables["SCRIPT_NAME"];
Hello,
Do you know how to get the ip address in text format i.e

www.helloworld.com rather than 10.10.10.10

I know about those
sw.WriteLine(Request.ServerVariables("REMOTE_ADDR"))
sw.WriteLine(Request.ServerVariables("HTTP_REFERER"))
sw.WriteLine(Request.ServerVariables("HTTP_X_FORWARDED_FOR"))
sw.WriteLine(Request.ServerVariables("REMOTE_HOST"))

but all I get is ip address in the "number" format
 
See System.Net.Dns to resolve the address (it can be done at the IIS level
but with some additional cost for *each* request).

As the example looks like a web site if you want the name of the site your
code is running this is Request.ServerVariables("SERVER_NAME") (likely
exposed in a friendly way by ASP.NET by a property such as
Request.Server.Name or something similar)

--
Patrice

One option is Request.ServerVariables["SCRIPT_NAME"];

Hello,
Do you know how to get the ip address in text format i.e

www.helloworld.com rather than 10.10.10.10

I know about those
sw.WriteLine(Request.ServerVariables("REMOTE_ADDR"))
sw.WriteLine(Request.ServerVariables("HTTP_REFERER"))
sw.WriteLine(Request.ServerVariables("HTTP_X_FORWARDED_FOR"))
sw.WriteLine(Request.ServerVariables("REMOTE_HOST"))

but all I get is ip address in the "number" format
 
Back
Top