Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CS0103: The name 'Encoding' does not exist in the current context

I have a webapplication running on framework 3.5 and is installed on multiple clients, working perfectly.

Except this one client... where all webservices that the application provide fail with the following error message:

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'Encoding' does not exist in the current context

Source Error:

Line 100: string EscapedFileName { Line 101: get { Line 102: return HttpUtility.UrlEncode(FileName, Encoding.UTF8); Line 103: } Line 104: }

Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\DefaultWsdlHelpGenerator.aspx Line: 102

Google points me toward the application might be targeting the client version of the framework or the system missing the system.web dll.

I've checked that both this possibilities are not the cause... Any ideas?

like image 680
Sergio Avatar asked Apr 04 '14 10:04

Sergio


People also ask

How do I fix error CS0103?

CS0103 is caused when you are using a name for a variable or method that does not exist within the context that you are using it. In order to fix the CS0103 error you will need to correct the name of the variable or method from where it is declared or referenced.

Does not exist in the current context c# asp net?

Many a times while writing a code we get this error which says, “The name does not exists in the current context”. This is because the code behind file is not able to find the control being added to your aspx file.


2 Answers

Try to use the namespace using System.Text;

like image 129
user3925123 Avatar answered Sep 19 '22 12:09

user3925123


I was able to fix this by locating the DefaultWsdlHelpGenerator.aspx file at the specified path and adding this to the Imports at the top:

<%@ Import Namespace="System.Text" %>

In my case, I was also seeing a similar error about HtmlUtility not existing, which I was able to fix by adding:

<%@ Import Namespace="System.Web" %>
like image 34
JLRishe Avatar answered Sep 20 '22 12:09

JLRishe