views:

1016

answers:

1

If I drop a System.Web.UI.WebControls.Login onto a page, should it redirect to the ReturnURL by default? Or do I have to set some config settings or write some code to make this work?

+1  A: 

Short answer: No.

If you do not specify a value for the DestinationPageUrl property, the user will be redirected to the original page the user requested after successfully logging in.

Full MSDN source

According to this blog post, it apparently also factors in whether the page with the login control is the LoginURL specified in web.config. It states:

If page is not defined as Login page in configuration file, ReturnUrl parameter is ignored completely.

Larsenal
Yep, that last bit is key: if it's not declared as the default login page, you need to set the DesitnationPageUrl otherwise the page will just sit there (you could always drop the login control in the Anonymous element of a LoginView control to hide it once the user is logged in).
Zhaph - Ben Duguid