Search Results

Search found 121 results on 5 pages for 'httpmodule'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Corrupt output with an HttpModule

    - by clementi
    I have an HttpModule that looks at the query string for a parameter called "cmd" and executes one of a small set of predefined commands that display server stats in XML. For example, http://server01?cmd=globalstats. Now, on rare occasions, like once out of hundreds of times, I will get corrupt output like this: <!-- the stats start displaying fine... --> <stats> <ServerName>SERVER01</ServerName> <StackName>Search</StackName> <TotalRequests>945</TotalRequests> <!-- ...until something has gone awry and now we're getting the markup of the home page! --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> ...the rest of the home page markup... (Remove the comments in the example above.) I'm not all that familiar with HttpModules and the IIS pipeline, but could this be a threading problem? Or, what else?

    Read the article

  • Execute HtttModule for extionsionless URL only

    - by Malcolm Frexner
    I have an httpModule which has to run before an ActionMethod. I dont want that it is executed when a request for an image comes in. For some reasons I realy need an HttpModule and cant use an ActionFilter What is the way to do this? public class PostAuthenticateModule : IHttpModule { public void Init(HttpApplication app) { app.PostAuthenticateRequest += new EventHandler(this.OnEnter); } private void OnEnter(object source, EventArgs eventArgs) { } private static void Initialize() { } public void Dispose() { } } web.config <httpModules> <add type="PostAuthenticateModule.PostAuthenticateModule , PostAuthenticateModule" name="PostAuthenticateModule"/> </httpModules>

    Read the article

  • Possible to map a new file extension to an existing handler in ASP.NET?

    - by Dave
    I have a scenario where my application is going to be publishing services that are consumed by both PC's and mobile devices, and I have a HTTPModule that I want to only perform work on only the mobile requests. So I thought the best way of doing this was to point the mobile requests to a different file extension and have the HTTPModule decide to process only if the request targets this new extension. I don't need a custom HTTPHandler for the new extension; I want to program the services like a normal .ASMX service, just with a different extension. First, can I do this? If so, how do I do it so that requests to my new extension are handled just like .ASMX requests? Second, is this the right approach? Am I going about separating and managing the mobile vs. PC requests the wrong way? Thanks, Dave

    Read the article

  • How to get original url after HttpContext.RewritePath() has been called.

    - by jessegavin
    I am working on a web app which makes use of a 3rd party HttpModule that performs url rewriting. I want to know if there's any way to determine the original url later on in Application_BeginRequest event. For example... Original url: http://domain.com/products/cool-hat.aspx Re-written url (from 3rd party httpmodule): http://domain.com/products.aspx?productId=123 In the past I have written HttpModules that store the original url in HttpContext.Items but, this is a 3rd party app and I have no way of doing that. Any ideas would be appreciated.

    Read the article

  • asp.net ajax + http module fails

    - by Sri Kumar
    Hi, I am trying my hands on asp.net+ajax+httpmodule. My Form <form id="LoginForm" runat="server"> <asp:ScriptManager ID="LoginScriptMgr" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="LoginPanel" runat="server"> <ContentTemplate> <asp:Label ID="lblLoginHeader" Text="Login" runat="server"></asp:Label> <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> <asp:Button ID="btnLogin" Text="Login" runat="server" OnClick="Login" /> <asp:Label ID="lblLoginStatus" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </form> C# Code protected void Login(object sender, EventArgs e) { lblLoginStatus.Text = "Login Successful"; } Web.config <httpModules> <add name="TimeModule" type="MyWebPortal.App_Code.TimeModule,App_Code"/> </httpModules> HTTP Module public class TimeModule : IHttpModule { private HttpApplication oApps = null; public void Dispose() { } public void Init(System.Web.HttpApplication context) { oApps = context; context.PreSendRequestContent += new EventHandler (context_PreSendRequestContent); } void context_PreSendRequestContent(object sender, EventArgs e) { string message = "&lt;!-- This page is being processed at " + System.DateTime.Now.ToString() + " -->"; oApps.Context.Response.Output.Write(message); } } When i remove the TimeModule from Web.config my ajax works. If add the TimeModule then the label doesn't show the message "Login Successful". Removing the ajax panel and with httpmodule available the label shows the message. So, how ajax panel was related to httpmodules?

    Read the article

  • ASP.NET Response Filter to Reformat the rendered output of ASPX pages?

    - by PropellerHead
    I've created a simple HttpModule and response stream to reformat the rendered output of web pages (see code snippets below). In the HttpModule I set the Response.Filter to my PageStream: m_Application.Context.Response.Filter = new PageStream(m_Application.Context); In the PageStream I overwrite the Write method in order to do my reformatting of the rendered output: public override void Write(byte[] buffer, int offset, int count) { string html = System.Text.Encoding.UTF8.GetString(buffer); //Do some string resplace operations here... byte[] input = System.Text.Encoding.UTF8.GetBytes(html); m_DefaultStream.Write(input, 0, input.Length); } And this work fine when using it on simple HTML pages (.html), but when I use this method on ASPX pages (.aspx), the Write method is called several times, splitting up the reformatting into different steps, and potentially destroying the string replacement operations. How do I solve this? Is there a way to let the ASPX page NOT call Write several times, e.g. by changing its buffer size, or have I chosen the wrong approach entirely, by using this Response.Filter method to manipulate the rendered output?

    Read the article

  • HttpModule with ASP.NET MVC not being called

    - by mgroves
    I am trying to implement a session-per-request pattern in an ASP.NET MVC 2 Preview 1 application, and I've implemented an IHttpModule to help me do this: public class SessionModule : IHttpModule { public void Init(HttpApplication context) { context.Response.Write("Init!"); context.EndRequest += context_EndRequest; } // ... etc... } And I've put this into the web.config: <system.web> <httpModules> <add name="SessionModule" type="MyNamespace.SessionModule" /> </httpModules> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <remove name="SessionModule" /> <add name="SessionModule" type="MyNamespace.SessionModule" /> </modules> However, "Init!" never gets written to the page (I'm using the built-in VS web server, Cassini). Additionally, I've tried putting breakpoints in the SessionModule but they never break. What am I missing?

    Read the article

  • Should I replace libapache2-mod-php5-filter with libapache2-mod-php5 on Debian 6 Apache 2.2.16?

    - by luison
    Upgrading various virtual machines we are having an issue with the Debian package upgrade to version 2.2.16 The upgrade (surprisingly) seems to remove libapache2-mod-php5 replacing it with libapache2-mod-php5-filter. This gave us some headache as the php.ini was pointing to the "old" one and some of the apache.conf conditional module rules stopped working. We can fix all those but we can't figure out if there would be any issues if we just "reversed" this and simply install libapache2-mod-php5 again and load that module instead of the "filter" one or in there is anyway to "alias" a module. I tend to think that the change "has a reason" but after reading apache2 and php5: module or filter I understand the module differences are to do with post delivery security issues.

    Read the article

  • Can I stop ASP.NET from returning 'The resource cannot be found.'?

    - by mackenir
    I have installed an HttpModule into my web app that will handle all requests with a given file extension. I want ASP.NET to handle all requests with the extension, regardless of whether there is an underlying file on disk. So, when I added the extension to the 'Application Extension Mappings', I unchecked the 'Verify that file exists' checkbox. However, this just transfers the file check to ASP.NET rather IIS, so I just get a different error page when requesting URLs with the file extension. Is there a way to preempt this ASP.NET file checking and intercept the requests?

    Read the article

  • Custom basic authentication fails in IIS7

    - by manu08
    I have an ASP.NET MVC application, with some RESTful services that I'm trying to secure using custom basic authentication (they are authenticated against my own database). I have implemented this by writing an HTTPModule. I have one method attached to the HttpApplication.AuthenticateRequest event, which calls this method in the case of authentication failure: private static void RejectWith401(HttpApplication app) { app.Response.StatusCode = 401; app.Response.StatusDescription = "Access Denied"; app.CompleteRequest(); } This method is attached to the HttpApplication.EndRequest event: public void OnEndRequest(object source, EventArgs eventArgs) { var app = (HttpApplication) source; if (app.Response.StatusCode == 401) { string val = String.Format("Basic Realm=\"{0}\"", "MyCustomBasicAuthentication"); app.Response.AppendHeader("WWW-Authenticate", val); } } This code adds the "WWW-Authenticate" header which tells the browser to throw up the login dialog. This works perfectly when I debug locally using Visual Studio's web server. But it fails when I run it in IIS7. For IIS7 I have the built-in authentication modules all turned off, except anonymous. It still returns an HTTP 401 response, but it appears to be removing the WWW-Authenticate header. Any ideas?

    Read the article

  • AJAX Partial Rendering issues for the default page in IIS 7 when using custom http module

    - by WiseGuyEh
    The problem When I try to make a AJAX partial update request (using the UpdatePanel control) from the default page of an IIS7 web site, it fails- instead of returning the html to be updated, it returns the entire page, which then causes the MS AJAX Javascript to throw a parsing shit-fit. The suspected cause I have narrowed the cause down to two issues- making an AJAX request to the default page when I have a certain custom http module registered. A partial rendering request to http://localhost will fail, but a partial rendering request to http://localhost/default.aspx will work fine. Also, If i remove the following line in my custom HttpModule: _application.PreRequestHandlerExecute += OnPreRequestHandlerExecute; The AJAX partial render will work correctly. Wierd huh? Another wierd thing... If I look at trace.axd, I can see that when a partial rendering request fails, two POST requests are logged for the one partial rendering request- one where the default.aspx page executes successfully (trace information such as page_load is logged) but no content is produced and a second that doesn't seem to actually execute (no trace information is logged) but produces content (HTTP_CONTENT_LENGTH is greater than 0). Please help! If anyone with a good knowledge of HTTP modules or the MS AJAX Http module could explain why this is occuring I would be very grateful. As it is, the obvious work arround is to just redirect to default.aspx if the request url is "/" but I would really like to understand why this is occurring.

    Read the article

  • httpModules not working on iis7

    - by roncansan
    Hi, I have the following module public class LowerCaseRequest : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(this.OnBeginRequest); } public void Dispose() { } public void OnBeginRequest(Object s, EventArgs e) { HttpApplication app = (HttpApplication)s; if (app.Context.Request.Url.ToString().ToLower().EndsWith(".aspx")) { if (app.Context.Request.Url.ToString() != app.Context.Request.Url.ToString().ToLower()) { HttpResponse response = app.Context.Response; response.StatusCode = (int)HttpStatusCode.MovedPermanently; response.Status = "301 Moved Permanently"; response.RedirectLocation = app.Context.Request.Url.ToString().ToLower(); response.SuppressContent = true; response.End(); } if (!app.Context.Request.Url.ToString().StartsWith(@"http://zeeprico.com")) { HttpResponse response = app.Context.Response; response.StatusCode = (int)HttpStatusCode.MovedPermanently; response.Status = "301 Moved Permanently"; response.RedirectLocation = app.Context.Request.Url.ToString().ToLower().Replace(@"http://zeeprico.com", @"http://www.zeeprico.com"); response.SuppressContent = true; response.End(); } } } } the web.config looks like <system.web> <httpModules> <remove name="WindowsAuthentication" /> <remove name="PassportAuthentication" /> <remove name="AnonymousIdentification" /> <remove name="UrlAuthorization" /> <remove name="FileAuthorization" /> <add name="LowerCaseRequest" type="LowerCaseRequest" /> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" /> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </httpModules> </system.web> It works grate on my PC running XP and IIS 5.1 but on my webserver running IIS7 and WS 2008 dosn't works, please help I don't know how to work this out. Thanks

    Read the article

  • Http Modules are called on every request when using mvc/routing module

    - by MartinF
    I am developing a http module that hooks into the FormsAuthentication Module through the Authenticate event. While debugging i noticed that the module (and all other modules registered) gets hit every single time the client requests a resource (also when it requests images, stylesheets, javascript files (etc.)). This happens both when running on a IIS 7 server in integrated pipeline mode, and debugging through the webdev server (in non- integrated pipeline mode) As i am developing a website with a lot images which usually wont be cached by the client browser it will hit the modules a lot of unnessecary times. I am using MVC and its routing mechanishm (System.Web.Routing.UrlRoutingModule). When creating a new website the runAllManagedModulesForAllRequests attribute for the IIS 7 (system.webServer) section is per default set to true in the web.config, which as the name indicates make it call all modules for every single request. If i set the runAllManagedModulesForAllRequests attribute to false, no modules will get called. It seems that the reason for this is because of the routing module or mvc (dont know excactly why), which causes that the asp.net (aspx) handler never gets called and therefore the events and the modules never gets called (one time only like supposed). I tested this by trying to call "mydomain.com/Default.aspx" instead of just "mydomain.com/" and correctly it calls the modules only once like it is supposed. How do i fix this so it only calls the modules once when the page is requested and not also when all other resources are requested ? Is there some way i can register that all requests should fire the asp.net (aspx) handler, except requests for specific filetype extensions ? Of course that wont fix the problem if i choose to go with urls like /content/images/myimage123 for the images (without the extension). But i cant think of any other way to fix it. Is there a better way to solve this problem ? I have tried to set up an ignoreRoute like this routes.IgnoreRoute("content/{*pathInfo}"); where the content folder contains all the images, javascripts and stylesheets in seperat subfolders, but it doesnt seem to change anything. I can see there a many different possibilites when setting up a handler but I cant seem to figure out how it should be possible to setup one that will make it possible to use the routing module and have urls like /blog/post123 and not call the modules when requesting images, javascripts and stylesheets (etc.). Hope anyone out there can help me ? Martin

    Read the article

  • Keep an object for the time the connection is running in ASP.NET

    - by vtortola
    Hi, I'm developing a web service with ASP.NET, is not an .asmx or WCF, it's a custom one, so I'm working with the Http classes (context, request, response, etc..). Session is disabled. I'm working with my own handler and module. I'd like to keep a object alive and accessible for the time the connection is alive. I mean, a request enters, I assign a DbCommand to it and that connection will use that command as long is doing things, when that connection is ended, the object should be disposed. I've thought, that I can add it to my IPrincipal implementation, then when the connection is authenticated in the module and the user retrieved, I can add that DbCommand to the IPrincipal, so I can retrieve it from wherever I want in the code, and after in the module EndRequest event, I can dispose it, but I don't know if there is a better approach to do this. What do you think? cheers

    Read the article

  • HTTP MODULE Event Does Not Fire When Click Browser's Back Button

    - by Ali
    I Wrote an Http Module that checks if logged user is restricted disables images on the page. void application_AuthorizeRequest(object sender, EventArgs e) { . . . if (context.User.IsInRole("Restricted")) { context.Response.StatusCode = 401; context.Response.End(); } The code works fine. When the page loads, every image on the screen disapears. but when I go to another page and click back button on the browser and goto previous page images appear. What should I? (I dont want to clear Cache every time) context.Response.Cache.SetNoStore(); context.Response.Cache.SetCacheability(HttpCacheability.NoCache);

    Read the article

  • How to use the Request URL/URL Rewriting For Localization in ASP.NET - Using an HTTP Module or Globa

    - by LocalizedUrlDMan
    I wanted to see if there is a way to use the request URL/URL rewriting to set the language a page is rendered in by examining a portion of the URL in ASP.NET. We have a site that already works with ASP.NET’s resource localization and user’s can change the language that they see pages/resources on the site in, however the current mechanism in not very search engine friendly since the language variations for each language all appear as one page. It would be much better if we could have pages like www.site.com/en-mx/realfolder/realpage.aspx that allow linking to culture specific versions of a page. I know lots of people have likely done localization through URL structures before and I wanted to know if one of your could share how to do this in the Global.asax file or with an HTTP Module (pointing to links to blog postings would be great too). We have a restriction that the site is based on ASP.NET 2.0 (so we can't used the 3.5+ features yet). Here is the example scenario: A real page exits at: www.site.com/realfolder/realpage.aspx The page has a mechanism for the user to change the language it is displayed in via a dropdown. There are search engine optimization and user links sharing benefits to doing this since people can link directly to a page that has content that is applicable to a certain language (this could also include right-to-left layouts for languages like Japanese). I would like to use an HTTP module to see if the first part of the URL after www.site.com, site.com, subdomain.site.com, etc. contains a valid culture code (e.g. en-us, es-mx) then use that value to set the localization culture of the page/resources based on that URL. So if the user accesses the URL www.site.com/en-MX/realfolder/realpage.aspx Then the page will render in Mexico’s variant of Spanish. If the user goes to www.site.com/realfolder/realpage.aspx directly the page would just use their browser’s language settings.

    Read the article

  • Running log operation in Http Modules?

    - by Niranjan
    Hi, I have a simple requirement in which I want to execute a long running application program on server (e.g. DTSX) I want to make an HTTP module for this, But I have a question whether the DTSX will run even if the user closes the page and browser. In my case user hits the handler with a query string but what if the user closes the browser immediately? How is the behavior different from simple linear page processing? I want my DTSX package to finish once its started no matter how much time it takes and also dont want to halt the user that is why I am using http modules in place of linear asp page processing. Reagrds, Niranjan

    Read the article

  • How to make from your Custom HTTP Module a stand alone HTTP server?

    - by Ole Jak
    How to make from your Custom HTTP Module a stand aloun TCP\HTTP server capable of for example runing near to any other HTTP server (on same port, just taking some URL namespace like www.example.com/myModule/blabla?id=anyID, and not beeng rood to my other servers like apache HTTP server with PHP (so I can steel call it www.example.com/myApach/blabla?id=anyID) and with my other C\C++ based servers.)? I need CODE examples...)

    Read the article

  • How is the order of execution for HttpModules determined?

    - by jessegavin
    Suppose that both FirstModule and SecondModule handle the Application_BeginRequest event. Will it execute in the order defined in the web.config? <httpModules> <add type="MyApp.FirstModule, MyApp" name="FirstModule"/> <add type="MyApp.SecondModule, MyApp" name="SecondModule"/> <add type="OtherApp.OtherModule, OtherApp" name="OtherModule"/> </httpModules> Are there other ways that the order can be specified?

    Read the article

  • VS2010 development web server does not use integrated-mode HTTP handlers/modules

    - by Domenic
    I am developing an ASP.NET MVC 2 web site, targeted for .NET Framework 4.0, using Visual Studio 2010. My web.config contains the following code: <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add name="XhtmlModule" type="DomenicDenicola.Website.XhtmlModule" /> </modules> <handlers> <add name="DotLess" type="dotless.Core.LessCssHttpHandler,dotless.Core" path="*.less" verb="*" /> </handlers> </system.webServer> When I use Build > Publish to put the web site on my local IIS7 instance, it works great. However, when I use Debug > Start Debugging, neither the HTTP handler nor module are executed on any requests. Strangely enough, when I put the handler and module <add /> tags back into <system.web /> under <httpHandlers /> and <httpModules />, they work. This seems to imply that the development web server is running in classic mode. How do I fix this?

    Read the article

  • Unknown http requests of type http://<domain>/cache/<32-digit-alphanumeric-key>

    - by Siva Bathula
    I am getting a lot of incoming requests with this structure: //domain_name/cache/22092e9b25c40809dfb94b6179166b26. I am running a .NET 4.0 website served from IIS 7.5. A lot of these URLs have no referrer URLs and come in randomly with a different 32 digit alphanumeric key. And I do not have any resource like '.../cache/...' on my website. I just want to eliminate such requests and want to understand where these are coming from at all. Any help would be appreciated.

    Read the article

  • How can I create an http handler to redirect all traffic to HTML pages?

    - by Eitan
    Our company would like to redirect all calls to html files on our server to a separate page. The html pages are NOT in an asp.net application. In order to do this, I've been writing and IIS Handler in asp.net. 1) Is this possible to add an IIS handler to redirect static content that isn't served by any asp.net engine, i.e. stand alone files on the server? 2) If it is possible, how do I do this? I created an http handler in a class library. In the app.config I added the handler to the and sections. I added the DLL to the GAC, I changed the html mapping to my custom IIS dll and nothing works. Is there a tutorial or explanation from A to B on how to do this? Thanks. E p.s. I'm using IIS 7.5

    Read the article

  • IoC Dependancy injection into Custom HTTP Module - how? (ASP.NET)

    - by Sosh
    Hi, I have a custom HTTP Module. I would like to inject the logger using my IoC framework, so I can log errors in the module. However, of course I don't get a constructor, so can't inject it into that. What's the best way to go about this? If you need the specific IoC container - I'm currently using Windsor, but may soon move to AutoFac. Thanks

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >