Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FormsAuthentication and GetRedirectUrl

Reply
Thread Tools

FormsAuthentication and GetRedirectUrl

 
 
Joe
Guest
Posts: n/a
 
      02-12-2008
Hello,

I'm using FormsAuthentication for a single page. If the user tries to go
direct to the page they are prompted to login. This all works fine. But if
the user doesn't have a user account and clicks the Create user account link
the GetRedirectUrl no longer has the original page they were going to.
Instead it has the default from the web.config.

Is there any way to preserve the original URL past the login page?

Ideally if the user clicks to create account, I want to transfer them to the
page to create it. Once done I want to direct them to their original page
which will prompt them to login.

I hope this makes sense.

Thanks,
Joe


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-13-2008
Hi Joe,

As for the Forms Authentication url redirction problem you mentioned, I
understand what you want to do and the difficulty here is
FormsAuthentication will only append originalUrl in querystring when the
redirection is caused by Unauthorization. For the "create new account"
case, it is not redirected by unauthorization, but by the user who click
the link, then the ASP.NET will not provide such url.

Currently, my suggestion is to manually keep such a url in session. for
example, in the page where you provide the "Create User account" link, you
can add the following code logic:

** you should modify the link to the create account page, append the
original url to the querystring of this link's url

** in the create account page, you can get the original url from
querystring and store it into session

** After user finished creating account, you can check the session
variable, if there is url exists, redirect to the url (if not exists due to
some reason, redirect the default location)

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Joe" <(E-Mail Removed)>
>Subject: FormsAuthentication and GetRedirectUrl
>Date: Tue, 12 Feb 2008 12:40:33 -0500


>
>Hello,
>
>I'm using FormsAuthentication for a single page. If the user tries to go
>direct to the page they are prompted to login. This all works fine. But if
>the user doesn't have a user account and clicks the Create user account

link
>the GetRedirectUrl no longer has the original page they were going to.
>Instead it has the default from the web.config.
>
>Is there any way to preserve the original URL past the login page?
>
>Ideally if the user clicks to create account, I want to transfer them to

the
>page to create it. Once done I want to direct them to their original page
>which will prompt them to login.
>
>I hope this makes sense.
>
>Thanks,
>Joe
>
>
>


 
Reply With Quote
 
 
 
 
Joe
Guest
Posts: n/a
 
      02-14-2008
Hi Steven,

I sort of thought that would be the case so I did manually track the url for
redirection after the user logs in.

Thanks,
Joe

"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Joe,
>
> As for the Forms Authentication url redirction problem you mentioned, I
> understand what you want to do and the difficulty here is
> FormsAuthentication will only append originalUrl in querystring when the
> redirection is caused by Unauthorization. For the "create new account"
> case, it is not redirected by unauthorization, but by the user who click
> the link, then the ASP.NET will not provide such url.
>
> Currently, my suggestion is to manually keep such a url in session. for
> example, in the page where you provide the "Create User account" link, you
> can add the following code logic:
>
> ** you should modify the link to the create account page, append the
> original url to the querystring of this link's url
>
> ** in the create account page, you can get the original url from
> querystring and store it into session
>
> ** After user finished creating account, you can check the session
> variable, if there is url exists, redirect to the url (if not exists due
> to
> some reason, redirect the default location)
>
> How do you think?
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> --------------------
>>From: "Joe" <(E-Mail Removed)>
>>Subject: FormsAuthentication and GetRedirectUrl
>>Date: Tue, 12 Feb 2008 12:40:33 -0500

>
>>
>>Hello,
>>
>>I'm using FormsAuthentication for a single page. If the user tries to go
>>direct to the page they are prompted to login. This all works fine. But if
>>the user doesn't have a user account and clicks the Create user account

> link
>>the GetRedirectUrl no longer has the original page they were going to.
>>Instead it has the default from the web.config.
>>
>>Is there any way to preserve the original URL past the login page?
>>
>>Ideally if the user clicks to create account, I want to transfer them to

> the
>>page to create it. Once done I want to direct them to their original page
>>which will prompt them to login.
>>
>>I hope this makes sense.
>>
>>Thanks,
>>Joe
>>
>>
>>

>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-15-2008
Thanks for your reply Joe,

If there is anything else need help later, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Joe" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
>Subject: Re: FormsAuthentication and GetRedirectUrl
>Date: Thu, 14 Feb 2008 11:23:43 -0500
>
>Hi Steven,
>
>I sort of thought that would be the case so I did manually track the url

for
>redirection after the user logs in.
>
>Thanks,
>Joe
>
>"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Hi Joe,
>>
>> As for the Forms Authentication url redirction problem you mentioned, I
>> understand what you want to do and the difficulty here is
>> FormsAuthentication will only append originalUrl in querystring when the
>> redirection is caused by Unauthorization. For the "create new account"
>> case, it is not redirected by unauthorization, but by the user who click
>> the link, then the ASP.NET will not provide such url.
>>
>> Currently, my suggestion is to manually keep such a url in session. for
>> example, in the page where you provide the "Create User account" link,

you
>> can add the following code logic:
>>
>> ** you should modify the link to the create account page, append the
>> original url to the querystring of this link's url
>>
>> ** in the create account page, you can get the original url from
>> querystring and store it into session
>>
>> ** After user finished creating account, you can check the session
>> variable, if there is url exists, redirect to the url (if not exists due
>> to
>> some reason, redirect the default location)
>>
>> How do you think?
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>>
>> ==================================================
>>
>> Get notification to my posts through email? Please refer to
>>

http://msdn.microsoft.com/subscripti...ult.aspx#notif
>> ications.
>>
>>
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent

issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each

follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach the
>> most efficient resolution. The offering is not appropriate for situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are best
>> handled working with a dedicated Microsoft Support Engineer by contacting
>> Microsoft Customer Support Services (CSS) at
>> http://msdn.microsoft.com/subscripti...t/default.aspx.
>>
>> ==================================================
>>
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> --------------------
>>>From: "Joe" <(E-Mail Removed)>
>>>Subject: FormsAuthentication and GetRedirectUrl
>>>Date: Tue, 12 Feb 2008 12:40:33 -0500

>>
>>>
>>>Hello,
>>>
>>>I'm using FormsAuthentication for a single page. If the user tries to go
>>>direct to the page they are prompted to login. This all works fine. But

if
>>>the user doesn't have a user account and clicks the Create user account

>> link
>>>the GetRedirectUrl no longer has the original page they were going to.
>>>Instead it has the default from the web.config.
>>>
>>>Is there any way to preserve the original URL past the login page?
>>>
>>>Ideally if the user clicks to create account, I want to transfer them to

>> the
>>>page to create it. Once done I want to direct them to their original page
>>>which will prompt them to login.
>>>
>>>I hope this makes sense.
>>>
>>>Thanks,
>>>Joe
>>>
>>>
>>>

>>

>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FormsAuthentication.GetRedirectUrl() Dominick Baier ASP .Net Security 2 09-10-2006 04:57 PM
1.x FormsAuthentication.GetRedirectUrl doesn't redirect =?Utf-8?B?c3Rzb25n?= ASP .Net 0 04-10-2006 03:44 PM
Help!! RedirectFromLoginPage and GetRedirectUrl =?Utf-8?B?U2FuZHk=?= ASP .Net 9 05-26-2005 09:10 PM
FormsAuthentication.GetRedirectUrl() returns only first parameter Brian Adkins ASP .Net Security 1 02-24-2004 07:41 PM
FormsAuthentication.GetRedirectUrl returns non-existing page ?? Rafi ASP .Net Security 0 12-24-2003 02:34 PM



Advertisments