I do not know why am I getting this error I have tried everything but I am still getting this error again and again. Any help which would solve this problem will be appreciated.
Here is the error:
Connection string in web.config
:
As the extension to the solution which I mentioned in the question's comment:
According to the article Tale of two web.config in MVC,
web.config in View folder
Implemented for blocking access to view folder and files directly via user request or through URL.
Web.config in project folder
Where all the appSettings
, connectionStrings
, configSections
and etc. are configured here and these settings/values are able to be accessible for the entire project.
Thus, you need to move the <ConnectionStrings>
section from web.config (in the root of the View folder) to Web.config (in the root of the project folder).