R
Roshawn
Howdy Programmers,
I'm using a custom html form - CHtmlForm @ http://www.codeproject.com/aspnet/CHtmlForm.asp - that allows me to use the HTTP
GET method (that is, I can supply a value for the form's action attribute and it won't be ignored by ASP.NET). Testing it
shows that it works great.
Of course, there are a few things I'd like to change, which is why I'm asking for assistance:
1. I'd like to prevent the form and its server controls from having their ID and Name attributes changed. For example, the
form's ID is always "aspnetForm" as well as its name. The ID for server controls is set to "ctl00_" and [somename] when it
should just be [somename]; likewise, the Name attribute is set to "ctl00$" and [somename] when it should just be [somename].
While I don't really care what ASP.NET does with the ID and Name of the form itself, I sure hate that it makes changes to
other controls' attributes. The problem reveals itself when using the HTTP GET method. The values of the controls are
passed in the querystring, but because the controls' Name attributes are changed they are url encoded which makes it
difficult to access those values using Request.QueryString in code. (Sure I could use Request.Form or something, but hey,
people want urls they can read and hack easily, not some encoded crap.)
2. I'd like to render the __VIEWSTATE and __EVENTVALIDATION hidden fields based on the form's Method attribute. If set to
"GET" these fields should be removed from the page. If set to "POST" or the action attribute contains no value, these fields
should be rendered on the page.
My reasons for this are simple: using HTTP GET, this garbage (hidden fields) are passed in the querystring and I'd like to
get rid of them plain and simple. Having them not show up in the page (by right-clicking the page and selecting View Source)
makes the page size smaller and spiders don't have to get hung up on reading all the crap contained in them, especially the
__VIEWSTATE field which could go on forever.
It may seem like a tall order, but what I want is to have the best of both worlds: the ability to use both HTTP methods
(especially the GET method) while using server controls without the need for Javascript. I hope you'll agree.
Thanks for the help,
Roshawn
I'm using a custom html form - CHtmlForm @ http://www.codeproject.com/aspnet/CHtmlForm.asp - that allows me to use the HTTP
GET method (that is, I can supply a value for the form's action attribute and it won't be ignored by ASP.NET). Testing it
shows that it works great.
Of course, there are a few things I'd like to change, which is why I'm asking for assistance:
1. I'd like to prevent the form and its server controls from having their ID and Name attributes changed. For example, the
form's ID is always "aspnetForm" as well as its name. The ID for server controls is set to "ctl00_" and [somename] when it
should just be [somename]; likewise, the Name attribute is set to "ctl00$" and [somename] when it should just be [somename].
While I don't really care what ASP.NET does with the ID and Name of the form itself, I sure hate that it makes changes to
other controls' attributes. The problem reveals itself when using the HTTP GET method. The values of the controls are
passed in the querystring, but because the controls' Name attributes are changed they are url encoded which makes it
difficult to access those values using Request.QueryString in code. (Sure I could use Request.Form or something, but hey,
people want urls they can read and hack easily, not some encoded crap.)
2. I'd like to render the __VIEWSTATE and __EVENTVALIDATION hidden fields based on the form's Method attribute. If set to
"GET" these fields should be removed from the page. If set to "POST" or the action attribute contains no value, these fields
should be rendered on the page.
My reasons for this are simple: using HTTP GET, this garbage (hidden fields) are passed in the querystring and I'd like to
get rid of them plain and simple. Having them not show up in the page (by right-clicking the page and selecting View Source)
makes the page size smaller and spiders don't have to get hung up on reading all the crap contained in them, especially the
__VIEWSTATE field which could go on forever.
It may seem like a tall order, but what I want is to have the best of both worlds: the ability to use both HTTP methods
(especially the GET method) while using server controls without the need for Javascript. I hope you'll agree.
Thanks for the help,
Roshawn