Blog Stats
  • Posts - 45
  • Articles - 0
  • Comments - 23
  • Trackbacks - 20

 

Server.Transfer and postback events bug

So here's a documented bug with ASP .NET 1.1 that microsoft accepts. The problem is when you have a postback control on a page and are using Server.Transfer along with it.

I am trying to figure out a secure way to transfer variables between pages without pushing it down to the browser with encrypted cookies. The application is too sensitive to have any user data on the client side. Maybe I have to go back to the good old way of shoving stuff in the Database :( . Anybody have suggestions to mitigate the problem? LEt me know.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Feedback

# re: Server.Transfer and postback events bug

Gravatar You simply need to change the form tag's action to the rewritten URL. You can do this one of two ways:

(1) Use javascript to remove the value, which defaults to the current URL, anyway.

RegisterStartupScript( "RemoveFormAction", "<script>document.forms[0].action = '';</script>" );

(2) Create an "action-less" form control that doesn't render that attribute. Use this instead of the regular HtmlForm in your page(s).

public class ActionlessForm : HtmlForm
{
protected override void RenderAttributes(HtmlTextWriter writer)
{
Attributes.Add("enctype", Enctype);
Attributes.Add("id", ClientID);
Attributes.Add("method", Method);
Attributes.Add("name", Name);
Attributes.Add("target", Target);
Attributes.Render(writer);
}
}

It's that simple! 10/4/2005 8:41 AM | Michael Flanakin

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

 

 

Copyright © Rishi Pande