views:

527

answers:

2

I'm using webforms with UrlRewriting.Net to rewrite pages, e.g.

http://www.example.com/stuff.aspx?c=30
becomes
http://www.example.com/stuff/30-this-stuff.aspx.

It works in so far as the correct content is loading; however, none of the postbacks are working (mostly buttons on the page). If I set up a breakpoint on Page_Load, I see that IsPostBack is always false. Any ideas on how to fix this? Right now I'm just on Visual Studio 2008.

EDIT: I have since switched to UrlRewriter.Net, which worked after a few tweaks (see Scott Gu's article). Besides here, I have posted my original problem to the developer's forum: if I ever get an answer, I'll post it here (unless else posts it here first).

A: 

You need to make sure it is doing something called ClientRebaseing which makes sure .NET is seeing the new URL vs the old Raw URL. See this post for more information:

http://www.ifinity.com.au/Blog/Technical%5FBlog/EntryId/46/Why-does-Url-Rewriting-break-all-my-image-links

Also I don't know if this is supported in UrlRewriting.NET, but my own URL Rewriter based off of Apache mod_rewrite does support rebasing the client path.

http://urlrewriter.codeplex.com

Nick Berardi
An interesting read, but unfortunately not the root cause of the problem.
Nick
A: 

I could be way off here, but I worked on a project that used UrlRewriter.Net and from what I remember, I think the issue you're having is not rewriting the form element's action attribute. View your source and see if the URL in <form action"..." ... /> is the same as what's in your address bar. I don't know how we did this because it was at another job and the technical lead there wrote the code to do that, but I imagine you would change the rendering of the form tag.

nickyt
Unfortunately this is not the case, but for those that are having problems with this in particular, here is a good article with a solution: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
Nick