We have old website developed in MVC 4 and when we migrated this website to new server its not working after checking its giving followinge error
Error On Page: Server Error in '/' Application. Runtime Error Description: Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
Error Logged in Database: c:\inetpub\vhosts\ABCDomain.com\httpdocs\Views\Home\Index.cshtml (2): error CS0103: The name 'ViewBag' does not exist in the current context
Other MVC based website work fine but only one website is giving error.
Any pointer what could be causing this error
For refrence i am adding web.config file also
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="DBContext" connectionString="Data Source=DBServer.apps.server;Initial Catalog=ABCDATABAE;User ID=ABCUSER;Password=PaswordABC" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.webServer>
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/font-woff"/>
<mimeMap fileExtension="woff2" mimeType="application/font-woff"/>
</staticContent>
<tracing>
<traceFailedRequests>
<clear/>
</traceFailedRequests>
</tracing>
</system.webServer>
<appSettings>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<authentication mode="None"/>
<compilation debug="true" targetFramework="4.5.1" tempDirectory="C:\Inetpub\vhosts\ABCDomain.com\tmp"/>
<httpRuntime targetFramework="4.5.1" requestValidationMode="2.0"/>
<!-- <customErrors mode="On" defaultRedirect="~/Error/General"> -->
<!-- </customErrors> -->
<customErrors defaultRedirect="~/Error/General" redirectMode="ResponseRewrite">
<error statusCode="500" redirect="~/Error/General"/>
<error statusCode="404" redirect="~/Error/General"/>
<error statusCode="400" redirect="~/Error/General"/>
</customErrors>
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication"/>
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.0.0" newVersion="5.2.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
</configuration>