asp.net - Why is Request.QueryString readonly? -
i thought couldn't change querystring on server without redirect.
but code works* me:
i'm amazed.
so here questions regarding this:
- why request.querystring readonly?
- why code/hack work*?
- how safe it, if change readonly done editing, both regarding bad errors or unexpected behaviour, , regarding maintaining , understanding code?
- where in event cycle make sense crazy edit if using pageload , onpagerender?
*more details:
i have page items grouped tabs. each tab asp:linkbutton
i want able link directly specific tab. querystring parameter 'tab=tabname'. works. when click new tab, querystring still in url, , tab specified in querystring gets activated , not 1 clicked.
by using request.querystring edit not happen. solution 'works'.
thanks in advance.
well querystring property readonly because cannot changed on single request. browser sends 1 request 1 string 1 collection created. hack uses reflection (i.e. manipulates code , memory) change stuff cannot change normally. hack breaks encapsulation , design of querystring property. should not use it. makes no sense design standpoint. query not change why change object represents it? browser can send new query string lying own code browser sent.
if want tabs use url use hyperlinks instead of linkbutton.
Comments
Post a Comment