Url Rewriting RRS feed

  • Question

  • User-1161463277 posted
    Currently I am rewriting urls in a shared hosting environment, of the form:- /pages/pagename Where both the pages directory and pagename directories are virtual. This works fine in both the vs2005 web server and IIS. However in IIS, the postback breaks when rewritten. I have read a lot of articles that suggest the error page being called by asp.net may cause postback to break, i dont understand how i can fix this. Is what i am trying to do possible?

    Am i missing something very basic?

    Many thanks,

    Monday, June 11, 2007 10:19 AM

All replies

  • User-233570146 posted

    I believe the postback issue is resolved as follows:


    <script type="text/javascript">

    Monday, June 11, 2007 10:48 AM
  • User-1161463277 posted
    I'm actually writing the action in with a custom form tag, by referencing the Context.items variable which is saved before I rewrite. This would have the same effect wouldn't it?
    Monday, June 11, 2007 11:19 AM
  • User-590788913 posted

    I suggest this article by Scott Guthrie: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

    The best solution is to use Control Adapter described in the article: "Handling ASP.NET PostBacks with URL Rewriting". In this way, no need to use your custom form.

    Javascript solution provided above will break in case user disabled JS on their browser or brower does not support JS.

    Tuesday, June 12, 2007 5:20 AM
  • User-1161463277 posted

    I did this, and it still reports a different page as postback adding an error url to the front. If I change this, it just ignores the PostBack altogether.

    Wednesday, June 13, 2007 6:43 PM
  • User-1642477646 posted


    Just write this script in the last of your page (In the  body section) might be it help full for you.

    Here for postback we are calling same url. If it is not usefull just reply.

    <script language="javascript">
    function NotPostback(sNewFormAction)
        if(document.layers) //The browser is Netscape 4
           document.layers['Content'].document.forms[0].action = sNewFormAction;
        else //It is some other browser that understands the DOM
            document.forms[0].action = sNewFormAction;

    Friday, June 29, 2007 9:52 AM