Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sebastian Dammark 547 posts 1287 karma points
    Oct 09, 2015 @ 13:05
    Sebastian Dammark
    0

    UrlRewrite won't work

    I have a link looking like this: ~/find-dealer/dealer?did=1234

    But I want a link looking like this: ~/find-dealer/dealer/what-ever-i-want/1234/

    I thought this would do it:

    <add name="Dealer Rewrite" 
            virtualUrl="^~/find-dealer/dealer/(.*)/(.[0-9]*)/" 
            rewriteUrlParameter="ExcludeFromClientQueryString" 
            destinationUrl="~/find-dealer/dealer?did=$2" 
            ignoreCase="true" />
    

    But all I get is this: The page cannot be displayed because an internal server error has occurred.

    This is what the log says: [T69/D31] An unhandled exception occurred System.InvalidOperationException: Sequence contains no elements at System.Linq.Enumerable.First[TSource](IEnumerable`1 source) at Umbraco.Web.Routing.NotFoundHandlerHelper.GetCurrentNotFoundPageId(IContentErrorPage[] error404Collection, String requestServerName, IEntityService entityService, PublishedContentQuery publishedContentQuery) at Umbraco.Web.Routing.ContentFinderByLegacy404.TryFindContent(PublishedContentRequest pcr) at Umbraco.Web.Routing.ContentLastChanceFinderByNotFoundHandlers.HandlePageNotFound(PublishedContentRequest docRequest) at Umbraco.Web.Routing.ContentLastChanceFinderByNotFoundHandlers.TryFindContent(PublishedContentRequest docRequest) at Umbraco.Web.Routing.PublishedContentRequestEngine.HandlePublishedContent() at Umbraco.Web.Routing.PublishedContentRequestEngine.FindPublishedContentAndTemplate() at Umbraco.Web.Routing.PublishedContentRequestEngine.PrepareRequest() at Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) at Umbraco.Web.UmbracoModule.

  • Sebastian Dammark 547 posts 1287 karma points
    Oct 14, 2015 @ 12:24
    Sebastian Dammark
    1

    Apparently the only problem was that the name attribute cannot contain spaces.

    So after changing name="Dealer Rewrite" to name="DealerRewrite" everything worked as intended.

  • 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.

Please Sign in or register to post replies