What Is HTTP Module And HTTP Handler
Jan 20, 2010clear my concept What is HTTP module and HTTP Handler and how does they work while page requesting???
How authentication and Authorization process work in asp.net?
clear my concept What is HTTP module and HTTP Handler and how does they work while page requesting???
How authentication and Authorization process work in asp.net?
i redirect a page from http to https using http module begin request handler .i am calling webservice using ajax but it is saying webserice not defined .which otherwise works fineits work fine when rediect page in page_load instead .but i need to add function for https to http in every page. i still not know why ajax is not working when i use http module for redirect
View 3 RepliesBackground:
We are using the Facebook API and receive back URLs for profile image thumbnails. Unfortunately the protocol is restricted to just HTTP and it doesn't support HTTPS. The page on our site that hosts the thumbnails is always delivered via HTTPS, and if we use HTTP for the thumbnails the user will receive security warnings from their browser.
Solution:
Build an HTTP Handler that "passes through" the image from the Facebook URL, but allow the handler to be called via HTTPS. Before I started coding I thought I could something like this:
Response.OutputStream = WebRequest.Create(FacebookUrlForThumbnail)
but I ended up having to save the image to an object in memory than write the image to the Response.OutputStream using the image save function.
Current Code:
[Code]....
This seems inefficient but I can't find a way of using the HTTP Handler as I orginally intended. Is there way of accomplishing the goal without creating the image memory and just "passing through" the call?
I create custom HTTP handler for auto generating file and I want to tell IIS7 to serve current request like normal static file because I need to use IIS and web.config file to control compression setting and any other HTTP header of current requested file.I know. there is an internal class called StaticFileHandler in ASP.net. But I cannot access it. Or you have any other way to work like this.
View 1 RepliesI'm trying to create an HTTP gzip/deflate module, but when I'm trying to get the Accept-Encoding header it returns null, I tried in IE8, FF, Chrome and Opera.
View 2 RepliesIf I make a http module it only catches .aspx files. Files with other extensions (.js, .htm) are ignored.
Does this have anything to do with IIS?
Strangely enough all extensions are caught on the ASP.net Web Development Server but not when hosted in IIS.
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) the session is not available and my code fails. If the page does have an aspx extension then all is ok.
View 3 RepliesI have a wap site with susciription and I want to check if users are authorized to see some pages. I have decided to use http module. Should I use AuthorizeRequest or BeginRequest to check the users status? and why?
View 2 RepliesI'm trying to install asp.net http module on my hosting server wich i don't control, ( it has asp.net 4.0 frameworkd and IIS v7.5 installed ). so far i compiled locally my module.cs file (i compiled it with visual studio 2010 Publish Web option)
using System;
using System.Collections.Generic;
using System.Linq;[code]....
and than nothing happened. what's wrong with it, how to debugg it?
EDIT: just found out that im running in classic mode. and it works fo web.config corrected for that mode.
Is it possible to create an http module without making an entry into the web.config or GAC?
View 1 RepliesCan anyone tell me if there is a way to convert all URL's to lowercase using an Http Module for URL rewriting? For example www.homeforhire.com/Home.aspx should be converted to lowercase.
I cannot use the IIS7 URL Rewriter because I need to perform database lookups as part of my URL rewriting.
I have researched this extensively but have not had any luck finding a solution.
The only alternative I can think of is to use a dynamically created canonical link in my page headers.
Our site uses urlRewriter http module that does the url rewriting for us. I want to create another http module that will handle our customize URL redirects. Now I want this new customize http module to be call before the UrlRewriter module (to avoid page not found messages the UrlRewriter generates). Is there a way we can contol the calling order ?
View 3 RepliesI have come across this question several times, you need to do some performance testing (request process times, load times, etc) or track unhanded exceptions. The answers usually come down to writing a HTTP Module, hook into specific events and log them somewhere, or use the built in health monitoring?
Why would we use one over the other? What are the pros and cons?
I have web services built with ASP.NET and ASP.NET clients consuming them. When consuming the webservices, how would I to force the clients to use https?
I don't want to force the whole site to use https by turning on require SSL in IIS.
Can I use the IIS7 URL rewrite module to re-route http requests to https?
Is it possible to debug the init event from a http module? If I set breakpoints, they don't get triggered.
View 2 RepliesI have an ASP.NET web forms site using Master Pages. It is using Unity as my IoC container. I have created an HTTP Module to build up the container using a couple of tutorials i found online. I need the dependency injection to work for User Controls and the only way i was able to get this to work was to hook into the Pages PreInit event as can be seen from the code below.
[code]....
I also have autoeventwireup set to true on the pages and master page. Can anyone shed any light on why the events are not firing? Is my Unity http module causing this to happen by dropping the event wiring? I can get this to work no problem in a basic example with no IoC involved.
I am making a Http Module for authentication in my web application in asp.net 2.0. When the AuthticateRequest event is fired then I get the userid and password values from current request. But Every time I am getting null in both. My code is here
[code]....
I am writing a custom HTTP module to implement user authentication and appropriate access rights. And for identifying access rights for the user also depends on identifying the client's machine details like IP address, machine name, etc. The access rights will depend based on from which location or machine the user is trying to login.
Can we get these details from the HttpApplication or HttpContext object?
I have the following setting in my web.config to redirect to a default page:
<defaultDocument>
<files>
<clear/>
<add value="default.aspx"/>
</files>
</defaultDocument>
For example when a user enters www.homeforhire.com they should be redirected to default.aspx (for operational reasons the user is then redirected to
www.homeforhire.com/home.aspx).
Instead an error is caught in the Rewrite module (which should not be activated). I am using an http module to perform URL rewriting.
It appears as if the default document setup is not working correctly, and the requested page ~/ is being sent to the Rewrite module, causing an error (which is then caught by my error handler and the user is redirected to the home page).
Entering www.homeforhire.com/default.aspx works correctly.
Can anyone tell me why the default document settings in the web.config do not appear to be working?
it possible to use an application event to save the username in a session variable? I would like to do something like this:
private void ContextOnBeginRequest(object sender, EventArgs eventArgs){
if (_context.Request.IsAuthenticated)
_context.Session["ID"] = _context.User.Identity.Name;
}
However in the above code I get an error saying that Session state is not available.
I'm trying to write an HTTP GET handler. The path should start with http://site/processTask and have a set of URL-encoded parameters. I have the following in my web.config
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<add verb="GET" path="processTask*" type="MyHandler.ProcessTaskHandler, MyHandler"/>
</httpHandlers>
now when I type the URL http://mysite/processTask in browser I get HTTP 404 but if I change the add verb line to the following one:
<add verb="GET" path="processTask.asmx*" type="MyHandler.ProcessTaskHandler, MyHandler"/>
and type http://mysite/ProcessTask.asmx in browser the handler is run and I get the response from the handler. What's the problem? Why is the handler run only when the path contains .asmx? How do I change web.config so that .asmx is not required?
Here's what I want to do:
I've created a class library project
and this has a class implementing
the IHttpHandler interface. Let's
call this class ZipHandler. Let's
say the namespace is Zip.
I want that whenever any Http
request comes for a zip file, my
ZipHandler should handle it,
regardless of whether the request is
to an Asp.Net application or a
normal virtual directory.
Queries:
Is it possible (it should be given
the hype about integrated pipeline
etc. in IIS 7)?
How to do it?
I am new to this topic. SO please look over my stupid mistakes. I have web application and its virtual directory path is as followshtpp://localhost/TxtXmlImggHandler/This root has three pages one for text, one for xml, one for images. Actually these pages call three different handlers. I had no problem when I send/receive some data to HTTPHandler for processing, had no problem when I request xml file from HTTPHandler.Now I am trying to get image from HTTPHandler, but no luck. All my HTTPHandlers are sitting in root of my web application
View 3 RepliesI successfully added and configured HttpHandler in an Asp.Net WebApplication, but facing problems while trying to add same HttpHandler to Asp.Net WebSite. I have registered it in the web.config, am i missing something This is the error I am getting Configuration Error
Description:
An error occurred during the processing of a configuration file required to service this request.
Parser Error Message: Could not load type 'MyHandler'.
Line 98: </pages>
Line 99: <httpHandlers>
Line 100: <add verb="*" path="*.result" type="MyHandler"/>
Line 101: <remove verb="*" path="*.asmx"/>
Here is handler
public class MyHandler: IHttpHandler
{
#region IHttpHandler Members
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
}
#endregion
}
NOTE: I have not made any request for the handler via url, it is just not letting me run application.
I have an VS2010 ASP.NET 4 web site app, to which I added the new Chart control.
When I deployed it to our web server, we get a" Internal Server Error 500." message.
I noticed that the following lines were added to the web.config since the last release, related to the chart control:
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
</httpHandlers>
If I remove this added code from the web.config, the site works--Except for the charting functionality.
How do I get the site and the chart page to work?
This is not an issue on IIS versions < 7.