locked
Loginstatus control issue RRS feed

  • Question

  • User-239001081 posted

    Hi there,

    In my Default.aspx page I have a Loginstatus contorl that redirect to Login.aspx, when user logs in than it redirect back to Default.aspx. If user browse my Login.aspx  page directly (not using the Loginstatus control on Default.aspx) and logs in than it redirected to the requested page Control.aspx.

    What I want is that when user clicke the Loginstatus control from Default.aspx it will redirect to the Login.aspx and upon successful login user will redirected to Control.aspx.

    Any ideas ?

    Monday, February 22, 2016 12:05 PM

Answers

  • User-1716253493 posted

    You use LoginView control

    Place Logincontrol in anonymous template, if you want to redirect back to current page

    Or place hyperlink to login.aspx, if you want redirect back to default page

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 23, 2016 12:37 AM
  • User614698185 posted

    Hi shtrudel,

    As oned_gk said, you could place Logincontrol in anonymous template, The AnonymousTemplate property specifies the content template to display to Web site users when they are not logged in to the Web site. This template is displayed when the Name property of the PageUser property is null.

    The AnonymousTemplate template is never displayed to authenticated users. If the AnonymousTemplate property is empty, no content is displayed to users who are not logged in.

    Please see: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.loginview.anonymoustemplate.aspx

    https://msdn.microsoft.com/en-us/library/ms178338.aspx

    Best Regards,

    Candice Zhou

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 24, 2016 8:36 AM

All replies

  • User37182867 posted

    Why have a default.aspx page then?

    If you need it then on the page load check to see if user is anonymous, if user is not anonymous then redirect to the other page.

    Monday, February 22, 2016 6:53 PM
  • User-1716253493 posted

    You use LoginView control

    Place Logincontrol in anonymous template, if you want to redirect back to current page

    Or place hyperlink to login.aspx, if you want redirect back to default page

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 23, 2016 12:37 AM
  • User614698185 posted

    Hi shtrudel,

    As oned_gk said, you could place Logincontrol in anonymous template, The AnonymousTemplate property specifies the content template to display to Web site users when they are not logged in to the Web site. This template is displayed when the Name property of the PageUser property is null.

    The AnonymousTemplate template is never displayed to authenticated users. If the AnonymousTemplate property is empty, no content is displayed to users who are not logged in.

    Please see: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.loginview.anonymoustemplate.aspx

    https://msdn.microsoft.com/en-us/library/ms178338.aspx

    Best Regards,

    Candice Zhou

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 24, 2016 8:36 AM