473,569 Members | 2,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

httpmodule to inject javascript includes?

I am trying to write a httpmodule to inject javascript includes on some of
the aspx pages we have.

For instance, I want to inject into the resulting IIS response something
like...

response.Write( "<script language='javas cript'>");
response.Write( "alert('tt');") ;
response.Write( @"</script>");

I kind of got it working. But I am wondering what the best httpmodule event
to hook into is? I want the code to inject right at the end of the web page.

Jeff
Aug 12 '08 #1
1 3485
I would go for OnEndRequest, given its the last event to occur.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"JHilbCRM" <JH******@discu ssions.microsof t.comwrote in message
news:7A******** *************** ***********@mic rosoft.com...
>I am trying to write a httpmodule to inject javascript includes on some of
the aspx pages we have.

For instance, I want to inject into the resulting IIS response something
like...

response.Write( "<script language='javas cript'>");
response.Write( "alert('tt');") ;
response.Write( @"</script>");

I kind of got it working. But I am wondering what the best httpmodule
event
to hook into is? I want the code to inject right at the end of the web
page.

Jeff


Aug 18 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1746
by: Fabien Penso | last post by:
Hi. I am looking for the proper way to fetch a webpage, inject javascript and run an IE component on it. I've been looking around with no luck. For now I thought about: 1. fetch the webpage with a webrequest 2. make modifications (I would prefer to have access to the DOM) 3. run an IE component on the new source
10
1873
by: Girish | last post by:
Ok, Ive been thinking about this problem for a while. I have 30 odd aspx pages (already built) on my website that I need to have some validation occur before the page should load. The validation is - TEST if javascript is enabled on the browser + some other plugin checks via javascript. Id rather implement this check without touching any...
3
12869
by: Angel | last post by:
Hi, I have a page which shows a matrix of names and grades for given period. All the grades fields must be editable and they can be up to 200 fields (20 students with 10 grades each) Since there are a lots of fields I do not want to go back and forth to validate entered values on any change. I decided that this may be achieved with some...
7
2572
by: nail | last post by:
Folks, I develop a HttpModule and it works correct, but one problem is occurs. After I register the httpmodule in the web.config, my pages (not testing http://localhost/site but http://my_machine_name/site) show problems when refresh the page. I guess some kind of javascript problems with the postback methods. Someone has any idea how can...
6
5718
by: Steve | last post by:
Hi there, I'm trying to create a new website that will have a common aspx file serve as a template. I want all other pages to use this file and 'inject' their own content i.e. user controls, static html etc. The thing is that I don't actually want these other 'pages' to exist on disk (since I don't want to have to maintain multiple aspx...
0
2215
by: Si | last post by:
I'm writing an HttpModule to intecept web method calls and retrieve custom authentication information from their SOAP headers. I have the httpModules tag in web.config and that appears to be getting parsed okay. If I mangle the type attribute or try to add the module twice I get configuration errors as expected. So I "assume" that the...
2
4573
by: walter | last post by:
Hi there, I know there is pool of HttpApplications, and for each request coming in, HttpRuntime will dedicate one from pool to serve the request. My questions are : 1. since HttpModule is plug into the process, does each instance of HttpApplication keep its own set of HttpModule instance or HttpModules are shared among all HttpApplication...
1
1730
by: Manso | last post by:
Hi, We want to create a generic request timer that will inject the time it took to render each page as a HttpModule. We want to be able to inject this just before the finishing </body> tag but I can't seem to find a event to add an handler for. The timer should start in BeginRequest and end after the code in Render has been executed but...
2
1586
by: ChrisA | last post by:
Is there a way to inject a large javascript function into an asp.net page, in 1.1 and 2.0?
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.