exact url typed in browser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Bauke

    exact url typed in browser

    how i can retrieve an exact url typed by user in a browser? in
    particular i'd like to get http://foo.bar.com/ without default content
    page defined in 'Documents' section in iis. i can't find proper
    ServerVariable, nor property in Request.
    the only way i see at the moment is to write own httpmodule or put
    aspnet_isapi.dl l in wildcard application maps in iis application config
    and check the url in Application_Beg inRequest, but both are extremaly
    unconvinient since i'd like to provide only a simple control for many
    different sites.
    or maybe it's just a misconfiguratio n? i use asp 1.1sp1 on iis/w2k3, but
    as i mentioned -- it should work in different environments.

    --
    Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike &&unix^W.net ;}
  • darrel

    #2
    Re: exact url typed in browser

    > how i can retrieve an exact url typed by user in a browser? in[color=blue]
    > particular i'd like to get http://foo.bar.com/ without default content
    > page defined in 'Documents' section in iis.[/color]

    I'm no expert, so I may be way off, but AFAIK, .net can only grab what's
    given to it, so if IIS is changing the URL, then you'll have to figure out
    how to pass the original through IIS.

    otherwise, maybe you can use javascript ( window.location .URL ) to grab what
    the browser sees and bast it back that way? Granted, that'd be dependant on
    javascript then...

    -Darrel


    Comment

    • bruce barker

      #3
      Re: exact url typed in browser

      when IIS recieves a request for http://foo.bar.com/ , is scans the directory
      for a default page, and if found, then sends a redirect to the browser. the
      browser then sends a request the new url (this is what you see in the server
      variables).

      you could write a module that did not use the redirect method, but used url
      rewriting and passed the original url as an additional header that the pages
      could lookup.

      -- bruce (sqlwork.com)


      "Daniel Bauke" <bonkey@bonkey. pl.eu.org> wrote in message
      news:uGSUnf2mEH A.556@tk2msftng p13.phx.gbl...[color=blue]
      > how i can retrieve an exact url typed by user in a browser? in
      > particular i'd like to get http://foo.bar.com/ without default content
      > page defined in 'Documents' section in iis. i can't find proper
      > ServerVariable, nor property in Request.
      > the only way i see at the moment is to write own httpmodule or put
      > aspnet_isapi.dl l in wildcard application maps in iis application config
      > and check the url in Application_Beg inRequest, but both are extremaly
      > unconvinient since i'd like to provide only a simple control for many
      > different sites.
      > or maybe it's just a misconfiguratio n? i use asp 1.1sp1 on iis/w2k3, but
      > as i mentioned -- it should work in different environments.
      >
      > --
      > Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike &&unix^W.net ;}[/color]


      Comment

      • Daniel Bauke

        #4
        Re: exact url typed in browser

        darrel said the following on 2004-09-15 23:50:
        [color=blue]
        > I'm no expert, so I may be way off, but AFAIK, .net can only grab what's
        > given to it, so if IIS is changing the URL, then you'll have to figure out
        > how to pass the original through IIS.[/color]
        but it should be available at least as something like
        ServerVariables["BROWSER_UR L"].
        it is irreplaceable when you have to generate content based on the url.
        when default page changes on a host you need to update it in the system,
        too -- it's unconvinient and error-prone. it might be simple when you
        host it for 5 sites, but what about when you serve content for 300 or
        1000? i'm really disappointed that such feature may be unavailable.
        [color=blue]
        > otherwise, maybe you can use javascript ( window.location .URL ) to grab what
        > the browser sees and bast it back that way? Granted, that'd be dependant on
        > javascript then...[/color]
        and then what i should do? reload a page? i need it on the server side,
        so unfortunately it's totally unacceptable not only because of
        dependency on js.

        but thanks for the answer, maybe it will draw more attention to the
        problem :-)


        --
        Daniel Bauke; http://www.bonkey.pl.e u.org;{happines s==bike&&unix^W .net;}

        Comment

        • Steve C. Orr [MVP, MCSD]

          #5
          Re: exact url typed in browser

          Have you tried using Request.Serverv ariables("SERVE R_NAME")
          or
          Request.RawURL
          ?

          --
          I hope this helps,
          Steve C. Orr, MCSD, MVP



          "bruce barker" <nospam_brubar@ safeco.com> wrote in message
          news:OpsZYM4mEH A.3480@TK2MSFTN GP09.phx.gbl...[color=blue]
          > when IIS recieves a request for http://foo.bar.com/ , is scans the
          > directory
          > for a default page, and if found, then sends a redirect to the browser.
          > the
          > browser then sends a request the new url (this is what you see in the
          > server
          > variables).
          >
          > you could write a module that did not use the redirect method, but used
          > url
          > rewriting and passed the original url as an additional header that the
          > pages
          > could lookup.
          >
          > -- bruce (sqlwork.com)
          >
          >
          > "Daniel Bauke" <bonkey@bonkey. pl.eu.org> wrote in message
          > news:uGSUnf2mEH A.556@tk2msftng p13.phx.gbl...[color=green]
          >> how i can retrieve an exact url typed by user in a browser? in
          >> particular i'd like to get http://foo.bar.com/ without default content
          >> page defined in 'Documents' section in iis. i can't find proper
          >> ServerVariable, nor property in Request.
          >> the only way i see at the moment is to write own httpmodule or put
          >> aspnet_isapi.dl l in wildcard application maps in iis application config
          >> and check the url in Application_Beg inRequest, but both are extremaly
          >> unconvinient since i'd like to provide only a simple control for many
          >> different sites.
          >> or maybe it's just a misconfiguratio n? i use asp 1.1sp1 on iis/w2k3, but
          >> as i mentioned -- it should work in different environments.
          >>
          >> --
          >> Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike &&unix^W.net ;}[/color]
          >
          >[/color]


          Comment

          • Daniel Bauke

            #6
            Re: exact url typed in browser

            bruce barker said the following on 2004-09-16 02:21:
            [color=blue]
            > when IIS recieves a request for http://foo.bar.com/ , is scans the directory
            > for a default page, and if found, then sends a redirect to the browser.[/color]
            not really. when i send such request:
            GET http://foo.bar.com/ HTTP/1.0
            Host: foo.bar.com
            [...]
            i got similar results:
            - with static html as default:
            HTTP/1.1 200 OK
            Cache-Control: no-cache
            Content-Length: 1621
            Content-Type: text/html
            Content-Location: http://foo.bar.com/Default.htm
            Last-Modified: Thu, 16 Sep 2004 01:36:49 GMT
            Accept-Ranges: bytes
            ETag: "ed660a28d9bc41 :2e60"
            Server: Microsoft-IIS/6.0
            MicrosoftOffice WebServer: 5.0_Pub
            X-Powered-By: ASP.NET
            Date: Thu, 16 Sep 2004 01:45:02 GMT
            Connection: close
            [and contents of the file]

            - when aspx is a default file the answer is quite similar, but without
            Content-Location header:
            HTTP/1.1 200 OK
            Connection: close
            Date: Thu, 16 Sep 2004 01:46:08 GMT
            Server: Microsoft-IIS/6.0
            MicrosoftOffice WebServer: 5.0_Pub
            X-Powered-By: ASP.NET
            X-AspNet-Version: 1.1.4322
            Cache-Control: private
            Content-Type: text/html; charset=utf-8
            Content-Length: 1617
            [contents]

            but Request.RawUrl shows "/Default.aspx". it looks like iis redirects a
            request internally, maybe using Server.Transfer ? anyway -- the request
            is single, without additional redirection from iis.

            --
            Daniel Bauke; http://www.bonkey.pl.e u.org;happiness ==bike&&unix^W. net;}

            Comment

            • Daniel Bauke

              #7
              Re: exact url typed in browser

              Steve C. Orr [MVP, MCSD] said the following on 2004-09-16 03:39:
              [color=blue]
              > Have you tried using Request.Serverv ariables("SERVE R_NAME")
              > or Request.RawURL[/color]
              no, both doesn't work for me. SERVER_NAME might be useful only when i
              check this in a root directory, but i may need also a foo.bar.com/xyxy/
              url. and RawUrl shows a current file, which i want to avoid.

              --
              Daniel Bauke; http://www.bonkey.pl.e u.org;happiness ==bike&&unix^W. net;}

              Comment

              • Steve C. Orr [MVP, MCSD]

                #8
                Re: exact url typed in browser

                You could do a little string parsing to trim off the current file.
                There are classes in the system.IO.Path namespace that might help.

                --
                I hope this helps,
                Steve C. Orr, MCSD, MVP



                "Daniel Bauke" <bonkey@bonkey. pl.eu.org> wrote in message
                news:eAY4QG5mEH A.2372@TK2MSFTN GP10.phx.gbl...[color=blue]
                > Steve C. Orr [MVP, MCSD] said the following on 2004-09-16 03:39:
                >[color=green]
                >> Have you tried using Request.Serverv ariables("SERVE R_NAME")
                >> or Request.RawURL[/color]
                > no, both doesn't work for me. SERVER_NAME might be useful only when i
                > check this in a root directory, but i may need also a foo.bar.com/xyxy/
                > url. and RawUrl shows a current file, which i want to avoid.
                >
                > --
                > Daniel Bauke; http://www.bonkey.pl.e u.org;happiness ==bike&&unix^W. net;}[/color]


                Comment

                • Daniel Bauke

                  #9
                  Re: exact url typed in browser

                  Steve C. Orr [MVP, MCSD] said the following on 2004-09-16 06:49:[color=blue]
                  > You could do a little string parsing to trim off the current file.
                  > There are classes in the system.IO.Path namespace that might help.[/color]
                  yes, i can, but i have no clue, when it is necessary. we consider a
                  general situation: what is the url in a browser? it may be any of:
                  - http://foo.bar.com/
                  - http://foo.bar.com/Default.aspx
                  - http://foo.bar.com/xyxy/NotDefault.aspx
                  - http://foo.bar.com/xyxy/
                  - http://foo.bar.com/xyxy/?param1=no&param2=yes
                  and i'd like to have an exact url which the browser requested. if
                  browser asks for /xyxy/NotDefault.aspx i cannot remove a file from the
                  url, because there's no reason for that.
                  but if there's a method to get default content files for the directory
                  in iss i would be very glad to use it.

                  --
                  Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike &&unix^W.net ;}

                  Comment

                  Working...