httpmodule

Debug HTTP Module Init Event From ASP.NET Application

Is it possible to debug the init event from a http module? If I set breakpoints, they don't get triggered. ...

Authentication Problem

Hi, I have one project in asp.net using httpModules. But i got one exception while debugging, the error shows like this: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'. I don't know whats the problem in my code, i refereed many ...

ASP.NET MVC2 Custom routing with wildcard or free text url

I have a requirement to add specific functionality to an asp.net mvc2 web site to provide addtional SEO capability, as follows: The incoming URL is plain text, perhaps a containing a sentence as follows "http://somesite.com/welcome-to-our-web-site" or "http://somesite.com/cool things/check-out-this-awesome-video" In the MVC pipeline,...

Activate form authentication for CSV files in IIS7

I have a website on IIS 7. This website has a HttpModule with an AuthorizeRequest event handler. This event does not fire for CSV files and I can access the file without logging in, I guess this is because IIS7 is not configured to require form autentication for CSV files. How can I set this? ...

httpModule for 404

I've created an httpModule to handle URL remappings, and it works great on my test system. A request for www.mydomain.com/Some_Fancy_URL gets rewritten to www.mydomain.com/some.aspx?fancy=23 and so on. When I deploy to the actual web site, I'm getting the default IIS 404 page though. After doing some research online, it would seem tha...

Ninject Intermittent exception thrown related to OnePerRequestModule

I just upgraded an existing implementation of Ninject from 1.5 to 2.0. I'm now seeing an intermittent exception getting thrown when many requests are happening in a short period of time. Here's the exception that is being thrown. Type: System.ArgumentException Message: An item with the same key has already been added. Source: ...

Adding a Http-Header in a HttpModule and read it out from a Page

I've tried to write my own HttpModule (IHttpModule) that adds a Header like that: public class MyModule: IHttpModule { public void Init(HttpApplication c) { c.BeginRequest += delegate{c.Response.AddHeader("MyHeader", "MyValue");}; } public void Dispose(){} } and tried to read in a aspx page like that: var x ...

Mixed authentication in ASP.NET application

I've got an ASP.NET application which uses forms authentication. We're adding on an HttpModule that responds to requests in the /webdav folder and below. We need to use basic/digest authentication for these requests. With <authentication> set to Forms in the root web.config, requests from webdav clients are receiving a 302 redirecting...

How to use inherited DLLs in Sub-applications

Context: I have an application which handles login/authentication as a root website in IIS7. In this website, I would like to have sub-applications which all use the same HttpModule, which is defined in the root site's dll. At the moment, I obviously get the "Could not load file or assembly 'CompanyName.Namespace' or one of its depende...

Is a HTTP Module as non-external dll possible in ASP.NET ?

Question: Normally, when you create a HTTP module, you create it as separate dll project and register that dll in the web.config. Now, is it possible to write a HTTP module directly in an ASP.NET project, so I don't have to create a separate dll project? Note: Don't say as an added project in the same solution, I mean in the same proj...

Inject/set property in httpmodule on application start

I have a httpmodule that contains a property. The httpmodule is used in my web application. I want to set the property in the httpmodule when my application starts and not have the overhead of setting it everytime the module is called. The value for the application is read from my app settings in the web.config. The httpmodule reside...

Preventing upload of large files in ASP.NET 4.0

We'd like to restrict the maximum upload file size in our web site. We've already set the appropriate limits in our web.config. The problem we're encountering is if a really large file (1 GB, for example) is uploaded, the entire file is uploaded before a server-side error is generated, and the type of the error is different whether the...

HTTP module session not being set in extensionless page

I have a HTTP module that I have written that needs to access the session. I have done the following: Module is registered in web.config Module attaches my method call to the PostAcquireRequestState event The module implement IRequiresSessionState However, when my page doesn't have an extension (i.e. as when htp://www.mywebsite.com)...

ASP.NET HttpModule, strange behaviour when using Response.Write to the current context...

Hi, I'm trying to understand why this very simple HttpModule fails. The code is a precursor to a simple HttpUrlRewriter that I need to develop for a test project. It appears that whenever I test the Request, and then execute a Response, the output is not written to the stream! I've attached the debugger (VS 2008) to the module, and a...

URL Rewrite in ASP.NET 3.5 and IIS 7 using HTTP Module

Hi StackOverflow, I am developing an application in ASP.NET 3.5 and IIS 7. I have written an HTTP Module to perform URL Rewrite, for instance, I want to rewrite a username to an Account ID "~/Profiles/profile.aspx?AccountID=" + account.AccountID.ToString(); See below: using System; using System.Collections.Generic; using System.Data;...

Forms Authentication - security

Hello, I have the following set up. 2 Web Sites A and B (each has it's own virtual directory). I have written a simple web service (asmx) that reads configuration of web site's A web.config. The .asmx file resides in the WebServices folder of site A. When creating web service reference from site B ran on the same IIS I get this error: ...