1
Vote

Query strings not on redirected URL

description

When directing from a URL with a query string the query string parameter is not being carried to the mobile URL. Please can you take a look into this.

Thanks

comments

danielhalse wrote Sep 11, 2013 at 10:26 AM

We implemented a workaround by using the source code and modifying the OnLoad method in EPiServer.Labs.MobilePack.Core.RedirectionPagePlugin.
Below is the modified code for reference:

// Legacy Code
// sender1.Response.Redirect(DataFactory.Instance.GetPage(GetPageReference(redirectionRule.DestinationPage)).LinkURL, true);

// New Code Start
var newurl = DataFactory.Instance.GetPage(GetPageReference(redirectionRule.DestinationPage)).LinkURL;
var context = HttpContext.Current;
if (!string.IsNullOrEmpty(context.Request.RawUrl))
{
    var oldurl = new UrlBuilder(context.Request.RawUrl);

    // Trim ? and append query string
newurl += oldurl.Query.TrimStart(new [] { '?' });
}

sender1.Response.Redirect(newurl, true);

// New Code End