Fool .Net into thinking it's a Postback (GET > POST) RRS feed

  • Question

  • User1323006662 posted
    i'm investigating ways to improve accessibility of asp.net apps, and my major sticking point is getting around the __doPostBack('', '') call that every LinkButton etc makes.

    Ideally I'd like to make custom controls which would, rather than a __doPostBack, each write out a std href of the form:


    ...and have an external JS file attach event handlers (__doPostBack) to each one on page load (client page load, obviously).  This would allow Javascript enabled browsers to do a normal postback, and non-js enabled browsers would pass the necessary parameters back in the querystring.

    I could hack each of my custom .Net controls to look for the querystring params etc, but i'm wondering if it would be possible to write an HTTPHandler to catch all GET requests containing the correct querystring params and 'rewrite' the request as a POST, adding the necessary params to the Forms collection.

    Any ideas?  Any thoughts and opinions on my plan are welcome.


    Tuesday, July 26, 2005 9:32 AM

All replies

  • User-1041436249 posted

    By default, the control on PostBack also comes into Page_Load. Perhaps in case of up-browsers, you would have checked IsPostBack to divert control flows to the event handler.

    Here comes the trick. Whatever, workaround querystring or form post you are trying to create for downlevel browsers, you need to have a Custom control divert (suitably checking Request.Params) from here.

    Remember that in case you are checking the default parameters in the Event Handlers (sender, EventArgs etc), these might vary between event handlers.
    Thursday, August 11, 2005 1:27 PM