Search code examples
asp.netc#-4.0popuphttpmodule

Can an HttpModule invoke a new IE pop-up window?


I am developing a custom application feedback tool. The idea is that when the user launches a particular application, I want a pop-up to appear, say a couple seconds after the user launches the application, that asks if they'd be willing to provide feedback. The pop-up will simply be a new IE window. So, something similar in functionality to:

Response.Write("<script>window.open('" + sUrl + "', 'mywindow','resizable= yes,scrollbars= yes');</script>");

We have numerous web apps (ASP.NET) in our company, and I think the quickest solution would be to drop an HttpModule into the application's solution. For an ideal example, see: http://www.foreseeresults.com/.

QUESTION: Is invoking a new internet browser pop-up possible with an HttpModule? Or is perhaps invoking JavaScript from an HttpModule possible on the client's browser?


Solution

  • You can achieve this by using ASP.NET HTTP Response Filters.

    You implement your custom filter and then set it inside a custom HttpModule or inside a Global.asax file by handling the PostReleaseRequestState event.

    Bellow is an article by Scott Mitchel on HTTP Response Filters.

    https://web.archive.org/web/20211029043851/https://www.4guysfromrolla.com/articles/120308-1.aspx

    This article contains two simple response filters, which should give you the right direction on how to implement your case. I suggest you to display a modal dialog using jQuery and display a message. When user confirms that dialog open a new web page in new window (this way you'll also get around popup blockers).

    Hope this helps!

    Regards, Uros