views:

77

answers:

1

I am looking to access the content of a web page that is going to be written to the browser. I have played around and tested using Form Adapters and that works great for any content between <form> and </form> but the content that falls outside of it is not in the context that is passed to the Form adapter.

Is there a way (via an HTTP Module I assume) to get to the content that is about to get dumped to the browser? I want to modify some of the text/tags that are in the output before it gets to the user and it won't always be between the <form> tags.

I am using VB.NET but have access to Code re-writers if you have a C# example.

Edit: What I am hoping to accomplish is editing the text that is sent to the browser and changing some of the URL's that are displayed. For example, internally when people use the content editor, all the images will come from the server "img.mysite.com" - but when it is served publicly, I want to have it come from "img1.mysite.com" or "img2.mysite.com", etc... up to the number of servers that we have. Plus, there are other items that we would want to change. I already have the RegEx that finds the tags that we want and replaces the text. I've implemented it in a Form Adapter and it works great. But, we have stuff that is outside of the <form> tag (<head>, etc) that I would like to get at.

By changing the URL, it will also allow me to get past the 2 Connection per URL limit.

Shawn

+1  A: 

An easier way to do this would be to set up round-robin DNS resolution so that resolution requests for the host name img.mysite.com are rotated between each of the actual servers that serve up images. Each server would be configured to understand that it is "img.mysite.com" so that it would handle the request.

tvanfosson
Yes, that does work too, but I was hoping to get past the browser connection limitation (2 connections per url) at the same time. (I should have included that in my edit...)
hacker
I see. Perhaps you could use a custom image control and override the Render event to replace the tags during the render phase.
tvanfosson
That would work for any image controls within the `<form>` tags, but not anything outside of it (inline-styles, preloading images outside of the form, etc....). I would like to get all text from `<html>` to `</html> and check for any img.mysite.com and adjust the source.
hacker
After playing around with it and looking into the caching side of things, the Round Robin/Load Balancer is the way I am going to do it. Less .NET overhead and better caching.
hacker