开发者

Preventing extra fields from being added to a asp.net form

I realize what I am trying to do is a little unconventional; but I want to make my search SEO. Basically I want the query string开发者_StackOverflow resulting from my search to be human readable; if I was doing straight html this would be cake:

<form method="GET"><input type="text" name="Zip" /></form>

I realize that I can change the form method in asp.net, however, all the asp.net state holders show up in the query string. I even tried disabling viewstate and removing all javascript submitting controls (to get rid of __EVENTTARGET) to no avail.

The thing is, I really want to keep using the same master page as I do in the rest of the site; does any one know of anything I can do short of building the page from scratch?

Thanks in advance!


Remove runat="server" in your form tag to get rid of __EVENTTARGET, however then you lose the reason for using WebForms.


As Rick Schott stated, you should consider ASP.NET MVC. Then you'll have no __EVENTTARGET no __VIEWSTATE no auto-generated id'S (although it's easily disabled). You can even have ASP.MVC working in the same project as classic ASP.NET.

Try it ASP.NET MVC

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜