More in this section
Forums / Developing with Sitefinity / URL Rewriting - Parameters & Postbacks

URL Rewriting - Parameters & Postbacks

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Justin
    Justin avatar
    13 posts
    31 Aug 2011
    21 Oct 2011
    Link to this post
    Hi guys,
    We're struggling with URL rewriting and going aroud in circles.  We can get rewriting working, via SF and IIS methods, where our query strings turn into more friendly heirarchy-style URLs.

    Using the IIS method, we've got this:
    <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
        <match url="^([^/]+)/([^/]+)/?$" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <action type="Rewrite" url="default.aspx?id={R:1}&name={R:2}" />

    which turns ~/10/example   into  ~/default.aspx?id=10&name=example   - this is exactly how we want it to work but the trouble comes when we post back.  Every time you postback, the URL grows, adding another set of parameters... in order, you get this (one line for each post-back):



    With a 'normal' .NET application, we can solve by adding specifying the action on the form:   form1.Action = Request.RawUrl, but we can't do this in SF.

    We get exactly the same behavior using the SF method:

    Can anyone shed any light on this?

    Thanks in advance,
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    26 Oct 2011
    Link to this post
    Hi Justin,

    How about you approach it the same way as in a normal .NET application. Create a class which inherits from InternalPage. Override OnPrerender method, get the form and assign it an action. Then substitute the built in InternalPage class with yours in ~/Sitefinity/cmsentrypoint.aspx file.

    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered