How can I get the name of my script?

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.
 
G

Guest

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
 
P

Patrice

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
 

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

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top