Postback error 404 when using url rewriting




Postback error 404 when using url rewriting
If you discover that your postbacks don't work and return a 404 (page not found) error when you're on a rewritten url, then this is because the postback is looking for a files that doesn't exist, but don't worry, the solution is simple.
 
Just add the below code to the Page_Load() section of your code, replacing form1 with the ID of your form tags:
  1. form1.Action = Request.RawUrl  
An example of this in place would be:
  1. Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load   
  2.         form1.Action = Request.RawUrl   
  3. End Sub  
If your form tag is in your Master Page, then add this code to your MasterPage.

2 people like this article, click here to say you like this article too (2)
Send a link to this page via email Send a link to this page