system.web

System.Web assembly is not found on .net 4.0 version

一笑奈何 提交于 2019-12-05 01:14:41
I updated .NET from 3.5 to 4.0 version, but after updating the assembly System.Web doesn't work any more. I'm getting the following error: Warning 1 Could not resolve assembly "System.Web". The assembly is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. Using the 3.5 version it works fine. How can I fix this? Muhammad Hasan Khan Change the project from ClientProfile to full .NET 4.0 The .NET Framework 4 Client Profile is a subset of the .NET Framework

How Add System.Web Reference To A Windows Form Application

耗尽温柔 提交于 2019-12-04 11:18:53
I want to use HttpUtility.UrlEncode in a windows form application, but i can not find System.Web in .NET (Add Reference) area! How can i add this assembly to my project? i am using .net 4... thanks in advance Right click on a project -> Properties -> Change Target Framework from .Net Framework 4 Client Profile to .Net Framework 4 When you remove a Client Profile restriction, you will see System.Web in .Net (Add Reference) area. 来源: https://stackoverflow.com/questions/13668537/how-add-system-web-reference-to-a-windows-form-application

Why can't I find or use UrlEncode in Visual Studio 2010?

孤街醉人 提交于 2019-12-03 23:28:05
I have a string that I'd like to encode into the standard URL format. From what I've found, I should be able to do this via the httpUtility.urlEncode method, but I don't seem to have that available. I've added "using" references to both System.Web and System.Net to no avail. I've also seen other references to server.urlEncode amongst other variants, but I don't see the method anywhere. I'm using the latest version of C# in Visual Studio 2010. Is the method called something different in this version, hidden somewhere else, or am I completely off base? By default, new projects in Visual Studio

Read Http Request into Byte array

余生颓废 提交于 2019-12-03 14:31:23
问题 I'm developing a web page that needs to take an HTTP Post Request and read it into a byte array for further processing. I'm kind of stuck on how to do this, and I'm stumped on what is the best way to accomplish. Here is my code so far: public override void ProcessRequest(HttpContext curContext) { if (curContext != null) { int totalBytes = curContext.Request.TotalBytes; string encoding = curContext.Request.ContentEncoding.ToString(); int reqLength = curContext.Request.ContentLength; long

Potentially dangerous Request.Form value was detected from the client

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 13:19:13
I am running an ASP.Net MVC application and facing the following error. As I am new to ASP.Net, could someone please help me as to what does it mean and how can I resolve it? I tried googling to understand it, but found different answers for the same error which left me more confused. Exception caught in Global.asax:System.Web.HttpRequestValidationException (0x80004005): A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$WarningCtl1$TXTWarningText=" This is the warni..."). at System.Web.HttpRequest.ValidateString(String value, String collectionKey,

Get Windows Username in ASP.NET without System.Web

怎甘沉沦 提交于 2019-12-02 06:09:22
问题 I have a reporting dll that is used in ASP.NET (Windows Authentication) and winforms projects. Sometimes it needs the username so if it was running in ASP.NET it would use: System.Web.HttpContext.Current.User.Identity.Name; and in windows WindowsIdentity.GetCurrent().Name Now I am trying to move to .NET 4 Client Profile so I need to avoid the System.Web reference in the reporting dll. Is there an alternative way to get the Windows Username for when the dll is running in ASP.NET which won't

Get Windows Username in ASP.NET without System.Web

喜夏-厌秋 提交于 2019-12-02 02:32:50
I have a reporting dll that is used in ASP.NET (Windows Authentication) and winforms projects. Sometimes it needs the username so if it was running in ASP.NET it would use: System.Web.HttpContext.Current.User.Identity.Name; and in windows WindowsIdentity.GetCurrent().Name Now I am trying to move to .NET 4 Client Profile so I need to avoid the System.Web reference in the reporting dll. Is there an alternative way to get the Windows Username for when the dll is running in ASP.NET which won't use System.Web. The only way I can currently see to avoid System.Web is to pass the Username as a

How can I do System.Web.Script.Serialization in C#?

亡梦爱人 提交于 2019-12-01 15:05:00
How can I do this in C# modern UI ? var url = "http://ajax.googleapis.com/ajax/services/feed/load?q=http%3A%2F%2Fwww.digg.com%2Frss%2Findex.xml&v=1.0"; var wc = new WebClient(); var rawFeedData = wc.DownloadString(url); //You can use System.Web.Script.Serialization if you don't want to use Json.NET JavaScriptSerializer ser = new JavaScriptSerializer(); FeedApiResult foo = ser.Deserialize<FeedApiResult>(rawFeedData); //Json.NET also return you the same strong typed object var apiResult = JsonConvert.DeserializeObject<FeedApiResult>(rawFeedData); It gives me error an error in WebClient and

How can I do System.Web.Script.Serialization in C#?

≯℡__Kan透↙ 提交于 2019-12-01 13:56:51
问题 How can I do this in C# modern UI ? var url = "http://ajax.googleapis.com/ajax/services/feed/load?q=http%3A%2F%2Fwww.digg.com%2Frss%2Findex.xml&v=1.0"; var wc = new WebClient(); var rawFeedData = wc.DownloadString(url); //You can use System.Web.Script.Serialization if you don't want to use Json.NET JavaScriptSerializer ser = new JavaScriptSerializer(); FeedApiResult foo = ser.Deserialize<FeedApiResult>(rawFeedData); //Json.NET also return you the same strong typed object var apiResult =

How do I add System.Web as a reference if I cant find it in the list of references?

我只是一个虾纸丫 提交于 2019-12-01 03:07:32
I'm working on a project in C#.Net 4.0. I am trying to use HttpUtility.HtmlDecode. To do so, I added using System.Web; to the top of the file. However, no reference to HttpUtility could be found. After Googling around a little bit I found that the common answer to this question was to add a reference to System.Web.dll by finding it in the list presented by right-clicking on References in the Solution Explorer and clicking "Add Reference...". Unfortunately, this was not in the list. I found System.Web.Services and System.Web.ApplicationServices, but no System.Web, and neither contained what we