|
|
Cry about...
|
| Name | Namespace | Common Qualified Name |
|---|---|---|
| Abs | Math | Math.Abs |
| AnchorStyles | System.Windows.Forms | |
| Application | System.Windows.Forms For Windows forms applications. |
|
| System.Web.HttpContext For web applications. |
Current.Application | |
| ApplicationDeployment | System.Deployment.Application | |
| Assembly | System.Reflection | |
| CultureInfo | System.Globalization | |
| Cache | System.Web.Caching | |
| ConfigurationManager | System.Configuration Also ensure that project contains reference to System.Configuration.dll |
|
| Current | System.Web.HttpContext | |
| Debug | System.Diagnostics | |
| Debugger | System.Diagnostics | |
| Directory | System.IO | |
| Dns | System.Net | |
| Encoding | System.Text | |
| EventLog | System.Diagnostics | |
| File | System.IO | |
| HtmlEncode | System.Web.HttpUtility | |
| HttpContext | System.Web | |
| HttpRuntime | System.Web | |
| HttpUtility | System.Web | |
| ImageFormat | System.Drawing.Imaging | |
| Marshal | System.Runtime.InteropServices | |
| NormalizationForm | System.Text | |
| Parallel | System.Threading.Tasks | |
| Process | System.Diagnostics | |
| Regex | System.Text.RegularExpressions | |
| Request | System.Web.HttpContext | Current.Request |
| Round | Math | Math.Round |
| SecurityMode | System.ServiceModel | |
| SecurityZone | System.Security | |
| Server | System.Web.HttpContext | Current.Server |
| ServicePointManager | System.Net | |
| SslPolicyErrors | System.Net.Security | |
| SmptMail | System.Web.Mail | |
| ThreadPool | System.Threading | |
| UnicodeCategory | System.Globolization | |
| UrlDecode | HttpContext.Current.Server.UrlDecode | |
| User | HttpContext.Current.User |
It is my intention to add to this table over time.
A less likely cause is that the project itself lacks a reference to the necessary library. This can arise when (for example) creating a class library and using web namespaces, for example:
The name 'HttpRuntime' does not exist in the current context
or
The name 'HttpContext' does not exist in the current context
even though the line "using System.Web" is included.
Add the reference to the project:
The required reference is listed in the table above (given under "Possible Cause 1"). If it is not listed then right click on "References" and select "Add reference...". In the "Add Reference" dialog box that will then appear, the reference you require will probably be on the ".NET" tab.
For example, the solution to "HttpRuntime (or HttpContext) does not exist" (even though "Imports System.Web" is included in the file) is to ensure that "System.Web" is listed as one of the project References.
These notes are believed to be correct for C# for the .NET 4, .NET 3, .NET 2 and .NET 1.1 frameworks, and may apply to other versions as well.
For the corresponding VB.NET version of this article please see "NNNN is not declared".