Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 380 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"The name 'HTML' does not exist in the current context" in MVC 3 Views

#11
Apologies for the necro post.

Selecting "Build | Rebuild Solution" corrected this issue for me in Visual Studio 2015. In my case, the warnings occurred after renaming the primary namespace of a project. A rebuild set everything straight.

Reply

#12
In my case my Packages folder was missing including MVC and Razor so I have updated packages in packages.config, reopened the view and it worked.
Reply

#13
I'm using ASP .net core. Solved mine by upgrading `Microsoft.AspNetCore.Mvc` from `1.1.2` to `1.1.3`.
Reply

#14
For me, I just restarted my Visual Studios and everything got fixed.
Reply

#15
All I had to do was close all views that were open in the editor and rebuild.
Reply

#16
Maybe I am a bit late to answer this question but this easy fix helped me:

Right click the file > Exclude from project.
Right click the file > Include in project.
Reply

#17
I'm using dotnet core sdk 2.2 and Visual Studio Professional 2019.

This was caused by Visual Studio mangling code.

Code was pasted into the razor view. Visual Studio would attempt but then fail to auto-format it. Part of the failure resulted in deleting code.

Pressing ctrl+z reverted the formatting but kept the pasted code. The razor compilation errors were then fixed (`The name 'Html' does not exist in the current context`)

Disable format on paste (see

[To see links please register here]

) under Tools -> Options -> Text Editor -> HTML -> Advanced
Reply

#18
All you need to do is Restart Visual Studio and check.
Reply

#19
You could try some following point:

- Close the `View` with the false errors.
- Close visual studio.
- open project again.
- clean your solution
- Rebuild your solution.

hopefully you will not get any of the similar errors now.

If you still have same problem. than Please check following steps.

- Make sure you have `web.config` file inside view folder. Becuase `MVC` has two `web.config`. one for solution and other one for project.

Your `web.config` file will seems like this which is inside `views` folder.

<?xml version="1.0"?>

<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<add namespace="Your Project Name" />
</namespaces>
</pages>
</system.web.webPages.razor>

<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>

<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>

<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
</configuration>

It worked for me. and hope for you also.
Reply

#20
Close Visual Studio => Delete the obj and bin folders located in your project => Start Visual Studio
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through