** formatting got a bit messed up
After setting breakpoints
I have identified that on the page where the Url.Action succeeds, it executes EPiServer.Web.Routing.ContentRoute.GetVirtualPath but never enters the SetQueryPamaters.
Whereas on the page where it fails, it does execute SetQueryParameters ?
Any ideas why this method would produce different results on different pages ?
For anyone else who may hit this issue, I believe the issue is due to the Action URL I was trying to render was the same page I was currently on.
If this is the case, then if carries on with processing in the EPiServer code and calls the SetQueryParameters which doesn't handle the null property values in this case.
If it was on different page, it doesn't carry on processing in the EPiServer code, instead I believe it returns a null and reverts to standard MVC Url.Action processing.
To overcome this I simple removed the queryStringModel and processed that myself.
var url = Url.Action("MyMethod", "MyController");
var queryString = string.Join("&", (new RouteValueDictionary(queryStringModel) as IEnumerable<KeyValuePair<string, object>>)
.Where(kvp => kvp.Value != null)
.Select(kvp => string.Format("{0}={1}", kvp.Key, HttpUtility.UrlEncode(kvp.Value.ToString()))));
var fullUrl = string.Format("{0}?{1}", url, queryString)
Hi,
I have copied a piece of markup from 1 page view to another but it won't work on the second page.
The markup in question is:
call stack is:
Setting breakpoints in