Server error in the application "/asp.netwebadminfiles" - VS 2013

I am working with an ASP.Net web application and I want to create a membership user, so I need to access the Web Configuration Tool for ASP.NET. I run IISExpress commands in Prompt and it works fine, but whenever I run http://localhost:5376/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\Users\user\Documents\Visual%20Studio%202013\Projects\MyWebsite&applicationUrl=/ in the browser, I got this error!

error message:

Server error in application /asp.netwebadminfiles.

Compilation error

Description: An error occurred while compiling the resource required to service this request. Review the following specific error details and modify the source code accordingly.

Compiler Error Message: CS0122: 'System.Configuration.StringUtil' is unavailable due to its level of protection

Source Error:

Line 987:

Line 988: // Match the unique identifier of the application

Line 989: line appId = StringUtil.GetNonRandomizedHashCode (String.Concat (appPath, appPhysPath)). ToString ("x", CultureInfo.InvariantCulture);

Line 990:

Line 991:

Source file: C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ ASP.NETWebAdminFiles \ App_Code \ WebAdminPage.cs Line: 989

+1
error-handling configuration-files iis-express asp.net-membership
source share
1 answer

I found the answer in this post in a comment from Mr_Coinche.

For those who encounter "CS0122:" System.Configuration.StringUtil "is unavailable due to its level of protection." This is a .net 4.6 error.

So, you can remove this framework (if you are on windows 8), for those who use windows 10, it seems difficult or impossible to remove .net 4.6 because it is installed with windows 10.

So there is an alternative, you can change

C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ ASP.NETWebAdminFiles \ App_Code \ WebAdminPage.cs file or

C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ ASP.NETWebAdminFiles \ App_Code \ WebAdminPage.cs, (depending on what you are trying to install)

Replace string

 string appId = StringUtil.GetNonRandomizedHashCode(String.Concat(appPath, appPhysPath)).ToString("x", CultureInfo.InvariantCulture); 

with these lines:

 Assembly sysConfig = Assembly.LoadFile(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll"); Type sysConfigType = sysConfig.GetType("System.Configuration.StringUtil"); string appId = ((int)sysConfigType.GetMethod("GetNonRandomizedHashCode") .Invoke(null, new object[] { String.Concat(appPath, appPhysPath), true })) .ToString("x", CultureInfo.InvariantCulture); 

Also, make sure you run Notepad (or any code editor that you choose) as an administrator, otherwise you will not have permission to save the file after making the changes. I made changes to both files - this is just another way of calling the same method, but in a way that matches its new level of protection in .NET 4.6

+1
source share

All Articles