« Previous Next »

Thread: Implementing the Default Document rule using the URL Rewrite Module

Last post 11-10-2009 5:37 AM by will1968. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 11-05-2009, 7:59 AM

    • will1968
    • Not Ranked
    • Joined on 01-27-2009, 10:45 AM
    • Posts 4

    Implementing the Default Document rule using the URL Rewrite Module

    I tried to implemented the Default redirect rule but the default.aspx (in the root folder of my site) page seem to postback onto itself when i click on an asp button or link button.

    I don't have a problem with a standard href link which successfully allows me to navigate to a new page.

    This is what I have for the url rewrite in the webconfig.....

    <rule name="Default Document" stopProcessing="true">
    <match url="(.*)default.aspx" />
    <action type="Redirect" url="{R:1}" redirectType="Permanent" />
    </rule>

    taken from http://blogs.msdn.com/carlosag/archi...commentmessage

    The code that should run and take me to a new page is this...

    Protected Sub cmdShoppingBasket_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdShoppingBasket.Click
    Response.Redirect("~/Shopping-Basket.aspx")
    End Sub 

    The code does a few other things as well before the response.redirect.

    The site is hosted on discountasp.net.

    Thanks

    Will

  • 11-10-2009, 5:03 AM In reply to

    Re: Implementing the Default Document rule using the URL Rewrite Module

    Hi,

    Unfortunately, this behave is expected. Currently, any post back won't work in this situation. When you clicked the button, a post request(for example: http://Website/default.aspx) was submitted, and this request was redirected to http://Website immediately. It looks like you submit a new get request, hence the code won't run. The standard href link does not post back, so it can be used. Í am sorry for not having a better answer for you.

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • 11-10-2009, 5:37 AM In reply to

    • will1968
    • Not Ranked
    • Joined on 01-27-2009, 10:45 AM
    • Posts 4

    Re: Implementing the Default Document rule using the URL Rewrite Module

    No that's a good answer, I understand.

    Thanks

Page 1 of 1 (3 items)
Microsoft Communities