ASP DropDown Causing ViewState To Appear In Address Bar
If you visit this page in Internet explorer, and choose a value from the "Current Media Releases" dropdown on the top right, eventually IE will try to redirect you to an ugly url containing this string:
__EVENTTARGET=selArchives&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=
The page should only be updating the selArchives Query string value.
The drop down has AutoPostBack set to true and the codebehind is in VB, here is the event handler:
Private Sub selArchives_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles selArchives.SelectedIndexChanged
Response.Redirect("index.aspx?selArchives=" + selArchives.SelectedValue)
End Sub
Obviously, I could just write the JavaScript myself, but I would like to find the source of the problem.
Not sure what specifically was causing the problem. Looks like it was a combination of a few factors.
Thanks for the help
Answer
First off, your page has javascript errors. Please fix them.
Second, you only see the ugly url when you select a date and click the go button. But you've got the dropdown set to auto postback. Ditch the button; you don't need it.
There's something screwy with the button in your codebehind. And the dropdown, as well, since it stops working after a few uses.
You'll have to post your page's source for any more help.
Related Questions
- → Function Undefined in Axios promise
- → React formatting dates with momentjs server side
- → AngularJS directive: "templateUrl" doesn't work while "template" works
- → how to add cannonical tag for ASPX .NET page
- → JavaScript in MVC 5 not being read?
- → URL routing requires /Home/Page?page=1 instead of /Home/Page/1
- → ASP.NET routing w/ changing article name
- → NumericTextBox Loses Value using Html.TextBoxFor, not HTML
- → How to do Bundling of css & js files in Drupal
- → Does the fact that every page is reachable through www.example.com and www.example.com/index have any SEO impact?
- → How to add rich snippet in a website?
- → UrlRewriting does not work on server, but on localhost it works fine on asp.net?
- → Bootstrap Nav Collapse via Data Attributes Not Working