Tech Off Thread

7 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Problem with Adam Kinney's 404/URL-Rewriting method

Back to Forum: Tech Off
  • User profile image
    W3bbo

    I'm using Adam Kinney's URL-rewriting method that 'plugs in' to IIS's 404 handler.

    When Server.Transfer("Foo", true) is used, the Request fields collection is passed fine, however viewstate is lost and Page.IsPostBack returns false, even if it should return true.

    Does anyone know of any workarounds?

    Also, in VS2005, where is the ISAPI VisualC++ template?

  • User profile image
    Maurits

    You could use the 404-rewriting method to redirect to the "real" page, rather than rendering the "real" page.  That should fix postback.

    For example, http://channel9.msdn.com/Forums/Coffeehouse redirects (rather than rendering in-place) for precisely the postback reasons you describe.

  • User profile image
    Maurits

    Another option - which many content-management systems use - is to create new directories and their associated default.aspx pages on-the-fly, when the user or forum is created.

  • User profile image
    sbc

    If only it was as easy as it is URL Rewriting with Apache. No messing around on the server. Just place a text file called .htaccess and do it from there. You could even do an entire site that consisted of a database, single index.php page and a .htaccess file.

    Why must everything be done through IIS? You have web.config, but you still need IIS for proper redirection (setting * to be handled by ASP.NET). No good on a shared hosted service (as they would probably not do that for you).



    Edit: I've used the 404 method for a while (before Channel9 did it) as it is a page that will always be hit when a uses goes somewhere that does not exist. The only worry I have is it skewing site stats.

  • User profile image
    AdamKinney

    "How do I wake the sleeping beast?"

    "Just call out his name and he will awaken."

    You're using ASP.NET 2.0 right?  I've got a link for you...

  • User profile image
    W3bbo

    AdamKinney wrote:

    "How do I wake the sleeping beast?"

    "Just call out his name and he will awaken."

    You're using ASP.NET 2.0 right?  I've got a link for you...



    Sorry my friend, I'm running ASP.NET1.1 Smiley

    But anyway, I've circumvented the problem by instead putting all the page logic into the file called by IIS for the 404 handling.

    But I've now hit a new problem with viewstate and control validation, I'll make a thread about it in a moment along with a test case.

  • User profile image
    NIN

    sbc wrote:
    If only it was as easy as it is URL Rewriting with Apache. No messing around on the server. Just place a text file called .htaccess and do it from there. You could even do an entire site that consisted of a database, single index.php page and a .htaccess file.

    Why must everything be done through IIS? You have web.config, but you still need IIS for proper redirection (setting * to be handled by ASP.NET). No good on a shared hosted service (as they would probably not do that for you).



    Edit: I've used the 404 method for a while (before Channel9 did it) as it is a page that will always be hit when a uses goes somewhere that does not exist. The only worry I have is it skewing site stats.


    Yep this is a problem.  I found a nice tool called CustomError www.port80software.com/customerror which creates a rules file for all error redirects.  A pretty penny but worth it if you have a lot of redirects needing to happen.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.