Search code examples
c#asp.netpostviewstate

Don't Post ASP.NET fields __EVENTTARGET, __EVENTARGUMENT and __VIEWSTATE


I would like to know if there is an efficient way to not post the ASP.Net fields __EVENTTARGET, __EVENTARGUMENT and __VIEWSTATE.

I am posting data to an external page which is not in ASP.NET, so it doesn't need those fields.

I have tried to disable the fields in my Page, but they are still submitted in the POST request (they only are empty).

Do I have to modify programmatically the POST content? Or can I set this in a config file?

Thanks !


Solution

  • The only way I found to prevent these ASP.Net fields to be posted is to remove the fields in the DOM with javascript.

    As they are hidden fields automatically included in the form, by removing them after the document loaded, they are not posted anymore.