How can I get the name of my script?

Discussion in 'ASP .Net' started by Guest, Jul 25, 2007.

  1. Guest

    Guest 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.
    Guest, Jul 25, 2007
    #1
    1. Advertising

  2. Guest

    Ray Costanzo Guest

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

    Ray at work

    <johan> wrote in message news:%...
    >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.
    >
    >
    Ray Costanzo, Jul 25, 2007
    #2
    1. Advertising

  3. Guest

    Guest 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
    Guest, Jul 25, 2007
    #3
  4. Guest

    Patrice Guest

    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

    <johan> a écrit dans le message de news:
    ...
    >> 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
    >
    >
    Patrice, Jul 25, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?B?bW9vcJk=?=
    Replies:
    7
    Views:
    819
    Roedy Green
    Jan 2, 2006
  2. ding feng
    Replies:
    2
    Views:
    2,806
    ding feng
    Jun 25, 2003
  3. Bobby Chamness
    Replies:
    2
    Views:
    2,390
    Joe Smith
    Apr 22, 2007
  4. Jack-2
    Replies:
    3
    Views:
    263
    Jack-2
    Dec 24, 2003
  5. Replies:
    6
    Views:
    165
Loading...

Share This Page