Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. HTTPResponse.Redirect question

HTTPResponse.Redirect question

Scheduled Pinned Locked Moved ASP.NET
questiondiscussion
5 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Josh Martin
    wrote on last edited by
    #1

    I've got an .ASPX page that I'm using as a registration page. Right now, people are being redirected to it via HttpResponse.Redirect("\Register"); On my registration page, I want to find out which page the user came from, so I can display a different message depending on which page they were on (Ie., some note about registering before downloading if they were on the "Downloads" page or a note about forum rules if there were on the main forum page). I tried using the UrlReferrer, but it seems to be null when the page is being redirected. Here's the sample code that I tried, but tmpURL is always null... Uri tmpURL = HttpRequest.UrlReferrer; if (tmpURL != null) HttpResponse.Write(":" + tmpURL.AbsolutePath + ":"); else HttpResponse.Write("Referrer is Null"); Any thoughts? Josh Early to bed, early to rise makes a man tired.

    L 1 Reply Last reply
    0
    • J Josh Martin

      I've got an .ASPX page that I'm using as a registration page. Right now, people are being redirected to it via HttpResponse.Redirect("\Register"); On my registration page, I want to find out which page the user came from, so I can display a different message depending on which page they were on (Ie., some note about registering before downloading if they were on the "Downloads" page or a note about forum rules if there were on the main forum page). I tried using the UrlReferrer, but it seems to be null when the page is being redirected. Here's the sample code that I tried, but tmpURL is always null... Uri tmpURL = HttpRequest.UrlReferrer; if (tmpURL != null) HttpResponse.Write(":" + tmpURL.AbsolutePath + ":"); else HttpResponse.Write("Referrer is Null"); Any thoughts? Josh Early to bed, early to rise makes a man tired.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Add the return path to the querystring like is done in FormsAuthentication. See the article on User Roles in FormsAuthentication article here on CP for some code (he/she actually do there own version here. Cheers :) WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

      J 1 Reply Last reply
      0
      • L leppie

        Add the return path to the querystring like is done in FormsAuthentication. See the article on User Roles in FormsAuthentication article here on CP for some code (he/she actually do there own version here. Cheers :) WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

        J Offline
        J Offline
        Josh Martin
        wrote on last edited by
        #3

        That was my initial thought, but I was hoping to avoid using querystrings (just wanted to be difficult, I guess). I only want the user to see: http://www.blah.com/register in the address bar instead of: http://www.blah.com/register/index.aspx?referfrom=forums&newbie=yes I can't think of the reason why I wanted to do it this way in the first place (other than that it looks 'cleaner'), but now that I have it in my head, I want to try and make it work (I'm stubborn like that:-D) Josh Find a penny, pick it up, and all day long you'll have a back ache...

        L 1 Reply Last reply
        0
        • J Josh Martin

          That was my initial thought, but I was hoping to avoid using querystrings (just wanted to be difficult, I guess). I only want the user to see: http://www.blah.com/register in the address bar instead of: http://www.blah.com/register/index.aspx?referfrom=forums&newbie=yes I can't think of the reason why I wanted to do it this way in the first place (other than that it looks 'cleaner'), but now that I have it in my head, I want to try and make it work (I'm stubborn like that:-D) Josh Find a penny, pick it up, and all day long you'll have a back ache...

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          you could always save those variables in the session state. :) Although I find querystring easier to work with. WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

          J 1 Reply Last reply
          0
          • L leppie

            you could always save those variables in the session state. :) Although I find querystring easier to work with. WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

            J Offline
            J Offline
            Josh Martin
            wrote on last edited by
            #5

            Doh! It's always the simple answers that are staring you right in the face... :-O Thanks for helping reboot my brain. Josh If you don't have anything nice to say, make sure you say it really loud...

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups