.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Communication between Page and HttpModule/HttpHandler

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

I have a third-party client-side control that can execute "URL actions" that send a request back to the server.  I'd like to be able to intercept the incoming request and use the event to update an UpdatePanel in my existing page rather than doing a postback to launch the new page.  I've looked at httpModules and httpHandlers - it seems there should be a way to raise a custom event (from an HttpModule/Handler) that my page could use to deal with the update panel.  I could then discard the request so that it doesn't cause a postback, but that's where I get lost in the ether.
Is there a good, accepted way to do this?


I have a third-party client-side control that can execute "URL actions" that send a request back to the server.  I'd like to be able to intercept the incoming request and update an UpdatePanel in my existing page rather than doing a postback to launch the newly requested page.  I've looke

View Complete Post

More Related Resource Links

spoofing a Page in the httpHandler.



I'm trying to spoof a System.Web.UI.Page in my httphandler, and while this works to some degree.. the "page" needs some added query strings to make this complete. Note below that I'm passing in a virtual path to the Page instance. Can anyone help? I tried adding the query strings to the p.Request object after the Page instance has been instantitated, but I believe the error is -- "Request is not available in this context"

Page p = (Page)BuildManager.CreateInstanceFromVirtualPath(virtualUrl, typeof(Page));

IHttpHandler handler = p;


httphandler(.ashx) to an (.aspx) page

How To  Redirect from httphandler(.ashx)  to an (.aspx) page in the same application ? http://forums.asp.net/t/1598111.aspx    can some expert confirm better approach

Using HttpModule to change master page dynamically on SharePoint 2010 site


I am trying to change master page dynamically on SharePoint 2010 site. I reviewed some documents (SharePoint: Dynamically Change Master Page: http://ranaictiu-technicalblog.blogspot.com/2009/10/sharepoint-dynamically-change-master.html) and I implemented IHttpModule, added it to GAC, modified web.config(safecontrol, httpmodule, module)
It works good! But I found some problems
1.Never catch the PreInit event for publishing pages
2."/_Layouts/RedirectPage.aspx" page occurred error
3.ContextMenu did not work

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using Microsoft.SharePoint;
using System.Configuration;
using Microsoft.SharePoint.ApplicationRuntime;

namespace MasterUtilModule
    public class MasterModule : IHttpModule
        public void Dispose() { }
        public void Init(HttpApplication context){

What is HttpHandler, HttpModule


What is HttpHandler, HttpModule?what is the use of these ?

What is HTTPModule and HttpHandler

Hi all,

   Pls explain me in plain words what is HTTPModule and HttpHandler?


Replace application.master page using httpModule


Hello Group, 

I am trying to write a custom httpModule to replace application.master page with my custom master page. I followed the following steps suggested in one of the blog:

***    Created a class library project

***    Wrote following piece of code:

using System;
using System.IO;

How to Register startup scripts to a page via HttpModule


I am trying to register a startup script using HttpModule but get an error 'The name 'Page' does not exist in the current context. Does anyone know how to register this startup script via HttpModule.


 public class AccessDeniedRedirect : IHttpModule
        protected void Page_Load(object sender, EventArgs e)

            string popupScript = "<script language='javascript'>" +
   "window.open('http://chwmosdevhg/pages/accessdeniedoverride2.aspx?ReqURL= + strWebURL;', 'CustomPopUp', " +
   "'width=200, height=200, menubar=yes, resizable=no') </script>";
            Page.RegisterStartupScript("PopupScript", popupScript);

        #region -- Private fields --
        private static AppSettingsReader m_Reader = new AppSettingsReader();
        //private static string m_SiteCollAnonCustomErrPG = "CustomAnonCustErrPG";
        //private static string m_SiteCollAuthCustomErrPG = "CustomAuthCustErrPG";
        private static string m_SiteCollCustAcsDndPG = "CustomCustAcsDndPG";

        public void Init(HttpApplication context)
            context.EndRequest += new EventHandler(context_AcessDenied);            

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

WCF Tutorial - Basic Interprocess Communication

What the heck is WCF? For a long time, I couldn't tell you exactly what it was. And honestly, I still don't think I can. WCF is such a broad concept that it's hard to boil down into a concise explanation. When I finally started reading about it, and getting beyond the concepts, things started to clear up. That's what today's tutorial is about - cutting through all the concepts and just use WCF to build a basic server and a basic client.

Getting Started with Windows Communication Foundation

Windows Communication Foundation (WCF) provides a unified framework for rapidly building service-oriented applications that makes it easy to build and consume secure, reliable, and transacted Web services. It unifies the capabilities in ASMX, WSE, Remoting, COM+, and MSMQ; therefore developers need to learn only one programming model.

Reduce ASP.NET Page size and complexity using JQuery

This is my first post on asp.net blog. ASP.NET Ajax and JQuery are two different ajax framework. In this post I will show, how we can enhance gridview using ASP.NET Ajax and JQuery. I also compare the implementation of these frameworks. In next posts i will explain more about JQuery and ASP.NET Ajax and also tell you "How to combine the power of both framework". My Future post will related to ASP.NET and related frameworks.


I have 2 web pages. First page has a textbox and a button control.

when I enter test and click on the button , system goes to the second page. And in the second page I want to access the Textbox in the first page. When I try to do this I get the following error.

"Object reference not set to an instance of an object. Following is my code :

Dim txt As New TextBox

' Find the server name on the previous page
txt = CType(Page.PreviousPage.FindControl("TextBox2"), TextBox)
If Not IsNothing(txt) Then
Response.Write("[Name Not available]")
End If

I know I could do this with session, but I want to use the Page.PreviousPage.FindControl. Any help is greatly appreciated

Serial Communication with the .NET Compact Framework

Learn how to make your applications communicate over a serial port and how to handle common issues when implementing serial solutions. After a general discussion about serial communication and a common serial communication standard, this article demonstrates a practical use of the technologies through sample source code written in C#.

Serial Port Communication Read and Write using C#.net

In this simple article you will learn that how you can Open and read COM port data using System.IO.Ports Namespace.
Simply just create New Project of windows application in C#.

Import ServiceProcess APIs
using System.IO.Ports

Imports System.IO.Ports

Write Parsing functions which parse port data according to attached device

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


Launch CMD File From ASPX Page


My organization uses a CMD file to install updated files for a major enterprise application. Currently, we send out an email to users with a link to the file and instructions to run it, BUT inevitably users don't update their machines until their in field and try to start the app.


We're now liking the idea of using an ASPX page to prompt the users to run the updates and to capture the fact that the updates have been run. I realize that we can't capture the success or failure of the update. But we'd like to capture the user accessed the page.


Is it possible to embed into the markup for the page a link to the file on the local intranet that the users can click on to run the file?

The user accessing the page would capture that they did just that. We'd deal with wether or not the update was actually installed or if it failed later with them directly.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend