httpcontext

Trying to update an ASP.Net MVC 1.0 project to MVC 2.0

I'm trying to update my project to ASP.Net MVC 2.0 from MVC 1.0. I've removed the references for System.Web.MVC to the newer versions. I'm getting an exception from the HTTPContext which reads "CurrentNotification = 'HttpContext.Current.CurrentNotification' threw an exception of type 'System.PlatformNotSupportedException'". What other...

Problem with retrieveing a stored cookie

Hey, I wanted to know if we can access the HttpContext class in the App_Code folder. I am asking so because i have a CommonMethods.cs class inside my App_Code folder. I have written a method that checks if a cookie exists on the client machine or not, but it does not return the cookie. Although when i write the same code on the ASPX.c...

Can a client dictate whether or not HttpContext is created?

We are getting a lot of hits from Googlebot and BingBot and it appears that none of these requests have an HttpContext. I originally thought that every http request will get a context which obviously is not the case so I'm trying to understand how does an HttpContext gets constructed, is it part of the negotiation between client and ser...

OperationContext.Current is null and all other contexts too

I have a WCF service defined as following: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.PerCall)] public partial class FrontEndService : IFrontEndService However, most of the time (but ...

What is httpContext.Response.SubStatusCode for?

What is httpContext.Response.SubStatusCode for? this value is part of the IIS integration mode pipeline. ...

Elmah for non-HTTP protocol applications OR Elmah without HttpContext

We are working on a 3-tier application, and we've been allowed to use the latest and greatest (MVC2, IIS7.5, WCF, SQL2k8, etc). The application tier is exposed to the various web applications by WCF services. Since we control both the service and client side, we've decided to use net.tcp bindings for their performance advantage over H...

asp.net mvc compress stream and remove whitespace

So I am compressing my output stream via an action filter: var response = filterContext.HttpContext.Response; response.Filter = new DeflateStream(response.Filter), CompressionMode.Compress); Which works great. Now, I would also like to remove the excess whitespace present. I found Mads Kristensen's http module http://madskristensen.ne...

Weird problem: IE8 user can't authenticate with web service

I have an asp.net app. It has a page that requires authentication. The authenticated user can view the page because he/she is authenticated. The page makes a jQuery Ajax call to a WCF service. The WCF service checks that the user is authenticated via HttpContext. I have a user that is using WinXP and IE8. This user can authenticate to th...

Using Structuremap to manage ObjectContext Lifetime in ASP.NET MVC

Hi, what I want to know If there is a way or an good article on how to manage the objectcontext life cycle through structuremap (I saw an example with ninject). Since I'm new to the methods and possibilities of SM I really don't know How/If possible to make it. In the first moment I wanted to make a singleton of the objectcontext per htt...

Using HttpContext.Current.Application to store simple data

I want to store a small list of a simple object (containing three strings) in my ASP.NET MVC application. The list is loaded from the database and it is updated rarely by editing some values in the site's admin area. I'm thinking of using HttpContext.Current.Application to store it. This way I can load it in the Global.asax: protec...

IHttpModule Init not fired

Hi, I have got problem with contextInfo [WebMethod] [SoapHeader("UserInfo", Direction = SoapHeaderDirection.In)] public void TestContext() { var user = ContextInfo.Current.User.LoginName; } UserInfo _userInfo; [System.Xml.Serialization.SoapElement(IsNullable = true)] public UserInfo UserInf...

Can I render html from ASP.NET Page objects outside ASP.NET applications?

I'm not talking about hosting ASP.NET with the 'ApplicationHost' class. For example, if I create a Console application, create a valid HttpContext object and pass it to the ProcessRequest of a custom Page object, will it fill the HttpReponse html like if it was running inside ASP.NET? ...

Unique way to identify page instance within HttpContext

You can get the name of a page within HttpContext via Request.Path. Is there a way to distinguish between different requests from the same page? That is when two different instances of yourpage.aspx make a request, how can you distinguish between the two using HttpContext? ...

Using httpcontext in unit test

I'm using C#4.0 and i need to unit test a service. The function inside the service returns a path similar to the variable i called expected, this is the path i'm expecting to get back. But when i run this test i'm getting the error that HttpContext.Current is NULL. What can i do to fix this issue so the test can be ran? [TestMethod] pub...

.NET - Using WebClient.Download File in a One-Way WebService

I have a simple one-way web service in my C# .NET web application. I need to download an image from a given URL and save it to my server. However, every OTHER time I call the service it works perfectly. The other times I get a "Thread was being aborted" exception on the webClient.DownloadFile line. I've read that WebClient uses httpWe...

ASP.NET - Get website's URL without HttpContext.Current (running in background thread)

Bit of a long shot, but is there a way in ASP.NET to dynamically get the website's URL (http://www.example.com) when there is no HttpContext.Current available. There is no HttpContext because the code is running in a background thread* (but under the ASP.NET AppDomain). I have a background process that sends emails out every evening, an...

IIS module and WCF

I have written an IIS module (base IHttpModule) that does some custom (OpenAuth) authentication before preceding to my WCF REST service. I have extended GenericPrincipal to track my user, with an IIdentity, and set the context.User field to my new principal: application.context.User = principal However, when I receive the context in WC...

How does HttpContext.Current work?

This is kind of a hard question to formulate. I'm wondering how HttpContext.Current gets assigned a unique instance for every request considering it's a static object? Thanks! ...

ASP.NET asynchronous controllers and calling Sync(); what is "Sync()"?

The Working with the BeginMethod/EndMethod Pattern section of Using an Asynchronous Controller in ASP.NET MVC refers to a Sync() method. It is not linked and I am having trouble finding documentation on it through google searches since sync is too common a term. Can someone point me in the write direction? To make sure that you have...

WCF service with HttpContext

I had a web service which I converted to wcf service with the same asmx extension. I have basicHttpbinding since my service talks to various clients like java, perl etc. I had a validation which had HttpContext.Current in it. But I know this will not work in wcf service. I am trying to use RequestContext or OperationContext but am not a...