Why is the class aspNetHidden still in my MVC project?

Rod Falanga 591 Reputation points
2021-06-04T00:58:23.003+00:00

I have a website which I started several years ago, using ASP.NET WebForms. (I've written a LOT of WebForms apps.) But I want to move with the times, so whenever Microsoft comes out with a new version of the .NET framework, I upgrade this app. And I started it over, or at least I thought I started it over, as a MVC app using .NET 5.

Tonight, I thought I'd put in more time on the app. I brought it up in MS Edge and then did a Ctrl-U to see the rendered HTML. Imagine my surprise when I saw this code snippet:

<div class="aspNetHidden">
   <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
   <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
   <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="X5CQRISbVwqII6d5rmef3I1kiZnEOSmg3rnRtLX6AVWuumec8snDhna+GND6DYejWI9ksQQK8xNJXoaISHmtgfsfDN8B7zfbey+/cIXZvxE=" />
</div>

That is the old ViewState from WebForms. I've seen that rendered on a bazillion WebForms pages I wrote. Have I done something wrong when I tried to update my website?

Developer technologies | ASP.NET | ASP.NET Core
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.