1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Url Rewrite: Querystring and Postbacks

Url Rewrite: Querystring and Postbacks

3 posts, 0 answered
  1. Kevin
    Kevin avatar
    5 posts
    Registered:
    15 Sep 2008
    31 Jan 2009
    Link to this post

    (V 3.5 Community Edition)

    Is anyone having a problem with url rewrite and postbacks? My page is setting a cookie in order to perform some filtering on some products that I'm displaying.

    When the postback occurs I get the ProductTypeID key in the URL, but worse is that when event handler executes for the LinkButton, The URL pattern display this way:

    http://localhost/Website/Products/Stainless-Steel-Products.aspx?ProductTypeID=1?ProductTypeID

    My code is attempting to pull the ProductTypeID from the url at this point but it's bombing since '?ProductTypeID' is being appended to the URL.

    I checked the form action on the page and here is what I found:

    <form name="aspnetForm" method="post" action="Stainless-Steel-Products.aspx?ProductTypeID=1%3fProductTypeID" id="aspnetForm">
    

    Here is the URL Rewrite Rule that I set:

    <rule>
            <url>/Products/Stainless-Steel-Bar\.aspx</url>
            <rewrite>/Products/Default.aspx?ProductTypeID=1</rewrite>
    </rule>

     Does anyone have a reason why the qs is being appended to the form's action value and how I can work around this?

    Thanks!
    Kevin

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    04 Feb 2009
    Link to this post
    Hello Kevin,

    We reproduced the problem. The UrlRewriter will work as expected in 3.6 though. In the meantime, you could use this rule:
      <rule> 
        <url>/Products/Stainless-Steel-Bar\.aspx(.*)</url> 
        <rewrite>/Products/Default.aspx?ProductTypeID=1</rewrite
      </rule> 

    Let us know if this works for you.

    Best wishes,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Kevin
    Kevin avatar
    5 posts
    Registered:
    15 Sep 2008
    06 Feb 2009
    Link to this post
    Thanks. That should work for now.

    Kind regards,
    Kevin
Register for webinar
3 posts, 0 answered