system.web

What is the difference between Convert.ToBase64String(byte[]) and HttpServerUtility.UrlTokenEncode(byte[])?

南楼画角 提交于 2021-02-18 10:22:10
问题 I'm trying to remove a dependence on System.Web.dll from a Web API project, but have stumbled on a call to HttpServerUtility.UrlTokenEncode(byte[] input) (and its corresponding decode method) that I don't know what to replace with to ensure backwards compatibility. The documentation says that this method Encodes a byte array into its equivalent string representation using base 64 digits, which is usable for transmission on the URL. I tried substituting with Convert.ToBase64String(byte[] input

Problem with <system.web.extensions> config group when upgrading to .NET 4.0

风流意气都作罢 提交于 2020-01-02 02:14:09
问题 So we've upgraded our site from 3.5 SP1 -> .NET 4. When we ran the site, we got an Internal Server Error (500), stating the following configuration group could not be read: <system.web.extensions> <scripting> <scriptResourceHandler enableCompression="true" enableCaching="true" /> <webServices> <jsonSerialization maxJsonLength="999999" /> </webServices> </scripting> </system.web.extensions> We commented out this section and the website ran fine (but now we are getting problems with JSON -

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

廉价感情. 提交于 2020-01-02 01:01:14
问题 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? 回答1: Change the project from ClientProfile

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

荒凉一梦 提交于 2019-12-30 08:07:40
问题 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

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

耗尽温柔 提交于 2019-12-30 08:07:09
问题 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

What is the use for IHttpHandler.IsReusable?

妖精的绣舞 提交于 2019-12-28 09:31:34
问题 I'm writing a IHttpHandler and I'll need to implement a IsReusable property. When I look at the MSDN documentation it says: Gets a value indicating whether another request can use the IHttpHandler instance. This isn't very helpful. In which situations should I use a reusable handler and in which situations should it not be reusable? Follow up questions: What is reuse? Can I maintain state (i.e. class variables) when Reusable = true ?? 回答1: This property indicates if multiple requests can be

What to use instead of HttpContext when using OWIN without System.Web

馋奶兔 提交于 2019-12-23 19:20:03
问题 We currently have a NancyFx project that we have wired up using OWIN. We are not using System.Web and we need some place to put our context that lives for the life of a request other than HttpContext. We have started implementing the context on a thread static variable so we can access the context anywhere in the application but we are worried that using Async calls will lose this thread static context. What do you use as a static accessor in lue of HttpContext when you divorce yourself from

Add System.Web Reference To A Windows 10 Universal App

南楼画角 提交于 2019-12-21 21:34:06
问题 I download a project on Gitgub Basically is a Console Application. But I want to translate this C# Console Application to a Universal Windows App. I want to use HttpUtility.UrlEncode in a windows 10 universal, but I can not find System.Web in .NET (Add Reference) How can I add this assembly to my project? Error: The "HttpUtility" Does not existin the current context. Im using Visual Studio 2015 I try with this question: How Add System.Web Reference To A Windows Form Application But doesnt

Potentially dangerous Request.Form value was detected from the client

核能气质少年 提交于 2019-12-21 04:48:08
问题 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="

Using MimeMapping in ASP.NET 5 (vNext)

放肆的年华 提交于 2019-12-18 12:45:43
问题 I'm trying to move my old mvc5 project to mvc6. Old code was: public string ContentType { get { if (!string.IsNullOrEmpty(FileName)) return MimeMapping.GetMimeMapping(FileName); return null; } } Error is The name 'MimeMapping' does not exist in the current context 回答1: The following code should work: string contentType; new FileExtensionContentTypeProvider().TryGetContentType(FileName, out contentType); return contentType ?? "application/octet-stream"; 回答2: There is a NuGet package MimeTypes