Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a button on my page which I use to redirect the user to the same page.
C#
protected void Undo123_Click(object sender, EventArgs e)
       {
           Page.Response.Redirect(Page.Request.Url.ToString(), true);
       }

I get this error:
Microsoft JScript runtime error:
Sys.WebForms.PageRequestManagetServerErrorException: An unknown error occurred while processing the request on the server.The status code returned from the server was 500

I got this error on every button click the day before, but when I closed the solution and opened it again, it was gone. Closing the solution does not work now.
May I know the reason behind this error and how do I resolve that in my case.

Thank you !
Posted
Updated 3-Feb-12 11:19am
v2

 
Share this answer
 
Comments
Warreer 3-Feb-12 2:16am    
I tried adding validaterequest="false" in page directive, but it does not help
Why do you want to reload your page??
Use UpdatePanel with property
UpdateMode="Conditional"


call UpdatePanel's Method "Update()" to reload the controls of Updatepanel
 
Share this answer
 
v2
Comments
Warreer 3-Feb-12 2:29am    
I wish to implement the Undo functionality wherein the user can change the values in the repeater , after that if the user presses the Undo button, the repeater undo all the changes made by the user and show the data that was there when the page was first loaded.
Rajesh Anuhya 3-Feb-12 22:21pm    
Edited: Code Tags added
--RA
Do you have any javascript code on the form. I think when its reloading its finding some value (...or something as per your code ) where its throwing exceptiion.

Your code in Undo123_Click is correct.
 
Share this answer
 
Comments
Warreer 6-Feb-12 4:12am    
No, I don't have any javascript executed on this button click.I am getting the error on every button that has the code to be executed at the server side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900