Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
It's a pretty commonly noted problem with the URL Rewriting software in Umbraco but not one I've seen solved.
The issue is when:
1. user navigates to a protected page while not logged in
2. user logs in
3. user is redirected to ugly url instead of the nice url
This is expected from the .NET control when placed in BeginRequest, AuthenticateRequest but is fine if placed in AuthorizeRequest.
Unfortunately this workaround can't be used with this url rewriting package.
Anyone found a way around this?
Fixed it myself ;-)
I set a session variable on page load in my login control if !Page.IsPostBack.
I then use that session variable as the destinationpageurl in the login control in the onloggingin event.
The code, for anyone who's interested:
In Page_Load:
if (!Page.IsPostBack)
{
Session["OriginalUrl"] = Request.Url.ToString();
}
private void QueryLessUrl(System.Web.UI.WebControls.Login ctrl)
string newUrl = string.Empty;
if (!string.IsNullOrEmpty((string)Session["OriginalUrl"]))
newUrl = Session["OriginalUrl"].ToString();
if (!String.IsNullOrEmpty(Request.Url.Query))
newUrl = newUrl.Replace(Request.Url.Query, String.Empty).Replace("?DataNodeId=",string.Empty);
ctrl.DestinationPageUrl = newUrl;
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
The bug with URL Rewriting & Login redirect
It's a pretty commonly noted problem with the URL Rewriting software in Umbraco but not one I've seen solved.
The issue is when:
1. user navigates to a protected page while not logged in
2. user logs in
3. user is redirected to ugly url instead of the nice url
This is expected from the .NET control when placed in BeginRequest, AuthenticateRequest but is fine if placed in AuthorizeRequest.
Unfortunately this workaround can't be used with this url rewriting package.
Anyone found a way around this?
Fixed it myself ;-)
I set a session variable on page load in my login control if !Page.IsPostBack.
I then use that session variable as the destinationpageurl in the login control in the onloggingin event.
The code, for anyone who's interested:
In Page_Load:
if (!Page.IsPostBack)
{
Session["OriginalUrl"] = Request.Url.ToString();
}
private void QueryLessUrl(System.Web.UI.WebControls.Login ctrl)
{
string newUrl = string.Empty;
if (!string.IsNullOrEmpty((string)Session["OriginalUrl"]))
{
newUrl = Session["OriginalUrl"].ToString();
if (!String.IsNullOrEmpty(Request.Url.Query))
newUrl = newUrl.Replace(Request.Url.Query, String.Empty).Replace("?DataNodeId=",string.Empty);
ctrl.DestinationPageUrl = newUrl;
}
}
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.