HTTPResponse.Redirect question
-
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. -
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.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.
-
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.
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...
-
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...
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.
-
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.
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...