Developer forum

Forum » CMS - Standard features » Show different page for login UI

Show different page for login UI

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

When you set permissions for a page, Dynamicweb shows the Login UI in the context of the current page. This means the Login pages uses the same layout file, menu and other settings as the page you're protecting. This isn't always desirable. Is there a way to use a different page instead, similar to how ASP.NET does it by redirecting you to a dedicated Login page and redirecting you back to the originally requested page after a successful login?

Imar


Replies

 
Mikkel Ricky
Reply
This post has been marked as an answer

This can be done using a bit of Razor in your login template:

@using System.Web;

@{
var request = HttpContext.Current.Request;
var response = HttpContext.Current.Response;
var signInPageId = Pageview.Area.Item["sign_in_page_id"];
response.Redirect("/Default.aspx?Id="+signInPageId+"&redirect="+HttpUtility.UrlEncode(request.Url.PathAndQuery));
}

This will redirect to a dedicated sign in page and redirect back to the current page after succesful sign in.

It's a hack, but it works …

Best regards,
Mikkel

Votes for this answer: 1

 

You must be logged in to post in the forum