Article

How to redirect to the login page

« Go Back

Information

 
Article Number000093710
EnvironmentProduct: Sitefinity
Version: 10.x, 11.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description
How to redirect user to the login page and set return url in custom code.
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
Use the following sample:
var currentUrl = this.Context.Request.RawUrl;
var authProp = new Microsoft.Owin.Security.AuthenticationProperties {
    RedirectUri = Telerik.Sitefinity.Web.RouteHelper.ResolveUrl(currentUrl, Telerik.Sitefinity.Web.UrlResolveOptions.Absolute)
};
Page.Request.GetOwinContext().Authentication.Challenge(authProp);

This will request user's login and then redirect back to the initial page, keeping the query string, if any.
Workaround
Notes
Attachment 
Last Modified Date1/9/2019 7:24 AM


Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025