system.web

Cannot add System.Web.dll reference

末鹿安然 提交于 2019-12-17 22:25:54
问题 I'm trying to use the HTTP functions contained in the System.Web.dll assembly. However, whilst the dll seems to exist in the same directory as every other dll Visual Studio 2010 references in my project, it fails to link in and raises a warning - "The referenced component 'System.Web' could not be found". The dll, however, is definitely there within the same folder as all others referenced by the project and selecting it in 'browse for reference' mode allows me to add it - it then fails to

how does System.Web.HttpRequest::PathInfo work?

北城余情 提交于 2019-12-12 18:22:30
问题 I am trying to understand the PathInfo property of System.Web.HttpRequest and how it is set. Why would it be empty in the following example? var p = new System.Web.HttpRequest("file.txt","http://file.com/files/file.txt",""); //PathInfo is always empty return string.IsNullOrEmpty(p.PathInfo) I am trying to pipe the Elmah interface through Nancyfx by invoking the Elmah.ErrorLogPageFactory::ProcessRequest(HttpContext context). but it does not work because Elmah.ErrorLogPageFactory depends on

Why is the ObjectStateFormatter class in the System.Web.UI namespace?

╄→гoц情女王★ 提交于 2019-12-11 13:33:07
问题 Very straight forward question. As far as I can see from the MSDN page, it seems to be all about serialization and nothing to do with Web! MSDN: ObjectStateFormatter Class 回答1: Simpy, it is quite tightly related to PageStatePersister and a few other web assets like Triplet (which I confess I've never heard of before). You are right in that fundamentally that class has little directly to do with web, but I can see why it would be tempting to leave it with it's siblings (with which it is

System.Web.Hosting not found in VS2008

穿精又带淫゛_ 提交于 2019-12-11 03:39:01
问题 I am trying to make a Cassini-like server for a particular asp.net web application. The Client is not happy with the Cassini interface, so I am just expanding the Cassini code, adding new features, and providing a fresh look to the UI. Now the problem I am facing is, all the files from Cassini source use the System.Web.Hosting namespace. Visual Studio throws me an error saying: The type or namespace name 'Hosting' does not exist in the namespace 'System.Web' (are you missing an assembly

httputility does not exist in current context in framework 3.5

末鹿安然 提交于 2019-12-10 20:37:32
问题 I'm trying to use HttpUtility.UrlEncode in my sharepoint project in the framework 3.5 but it doesn't recognise it. Simply saying : HttpUtility does not exist in current context I called System.Web but it still doesn't recognise none of the Http objects ! 回答1: You need to add a reference to System.Web.dll A using System.Web without the above reference will not suffice alone. Unfortunately, the System.Web.dll cannot be referenced in a project that targets a Client Profile version of the .Net

Why do I get an HttpException from VirtualPathUtility ToAbsolute with some paths?

拜拜、爱过 提交于 2019-12-10 16:24:27
问题 I'm trying to use VirtualPathUtility.ToAbsolute to resolve app-relative paths, such as ~/MyPage.aspx , to application-absolute paths, such as /MySite/MyApp/MyPage.aspx . However, with some paths, I receive an HttpException saying that my path is "not a valid virtual path". Examples: // This works: var abs1 = VirtualPathUtility.ToAbsolute("~/MyPage.aspx#anchor"); // This errors: var abs2 = VirtualPathUtility.ToAbsolute("~/MyPage.aspx?key=value"); What's going on? 回答1: Because you're using .NET

System.Web.HttpContext.Current nulls itself after checking for a Cache

泪湿孤枕 提交于 2019-12-10 15:30:14
问题 I encountered a weird issue today which made no sense to me. Here is a summary: Inside a method, I check for a cached item as below: private async Task<RatesStatus> getRatesStatusAsync() { //... if (_currentHttpContext != null) { //Here, I am checking for a Cached item var cachedRatesStatusObj = HttpContext.Current.Cache[Constants.RATESSTATUS_CACHE_KEY_NAME]; if (cachedRatesStatusObj != null) return (RatesStatus)cachedRatesStatusObj; } //... cacheRatesStatusObject(ratesStatus); //... } Here,

C#/.NET - Help, I have only three classes in my System.Web namespace

倖福魔咒の 提交于 2019-12-10 11:33:56
问题 I discovered the problem when I got a suggestion to use the System.Web.HttpUtility class for a certain task. Looking at the documentation, I should have about 50 classes in System.Web, but I have only these: AspNetHostingPermission AspNetHostingPermissionAttribute AspNetHostingPermissionLevel I make this assumption since they are the only ones showing up in intellisense, and I get build errors when trying to use any other classes than these three. I'm using .NET 3.5 SP1, and in the reference

Portable Class Library (PCL) Version Of HttpUtility.ParseQueryString

你。 提交于 2019-12-09 08:35:11
问题 Is there a Portable Class Library (PCL) version Of HttpUtility.ParseQueryString contained in System.Web or some code I could use? I want to read a very complex URL. 回答1: HttpUtility.ParseQueryString returns HttpValueCollection (Internal Class) which inherits from NameValueCollection . NameValueCollection is a collection of key value pairs like a dictionary but it supports duplicates, maintains order and only implements IEnumerable (This collection is pre-generics). NameValueCollection is not

HttpContext not available in Class Library

廉价感情. 提交于 2019-12-09 02:12:13
问题 I am working on a project where I have a C# class library which needs to use the System.web.HttpContext . I've done this before in another project without problem but now its not working. I'm not sure what I am missing they're both targeting .net 3.5 and I've added the reference System.web and added the directive using System.web . However, when I try and do HttpContext nothing is found. I've tried using the full path System.web.HttpContext but the only thing that comes up are 3 items related