Hi Paul,
Thanks for posting in the community!
From your description, you'd like to do some pre-process on a certain
ASP.NET web request?
In the former messages, Teemu Keiski has mentioned the means use the
"HttpModules". I thinkyou can also implement the same operations in the
HttpModules in the Application's Global object (Global.asax/
Global.asax.cs). There're also the same events in the Global object to help
you hook the web request's processing. For example:
protected void Application_BeginRequest(Object sender, EventArgs e)
{...}
protected void Application_EndRequest(Object sender, EventArgs e)
{...}
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{...}
Then, if you want to some operations on the Request's data, you can
retrieve the Request object via
"HttpContext.Current.Request" , it has several members to help do some
modifications on it, such as:
HttpContext.Current.Request.InputStream;
HttpContext.Current.Request.FilePath
For more detailed info on the Global object and Request object, you may
view the following reference in MSDN:
#Global.asax File
http://msdn.microsoft.com/library/en-us/cpguide/html/cpcontheglobalasaxfile.
asp?frame=true
#HttpRequest Class
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebHttpRequest
ClassTopic.asp?frame=true
In addition, since you mentioned that
" what if I have a text file that contains macros that
I want to expand BEFORE ASP.NET processes the page"
Do you mean that you want to do some modification on the certain ASPX
page's page source before it is compiled and used to process the Request?
If so, the aspx( httpHandler) will be created at runtime by HandlerFactory,
though it is described behind the HttpModules in the ASP.NET's pipline, but
it is likely that it has been compiled and created( the instance) when the
certain hooked events(Request_Begin...) is fired. So I think as for such
situation, maybe you can consider implement a custom httphandler which will
deal with the certain kinds of request, then delegate the other detailed
processing behind that httphandler( it is just like a proxy), how do you
think of this?
Here're some tech references and articles on HttpHandlers:
#HttpHandlers
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconhttphandlers.asp?f
rame=true
#Implementing Front Controller in ASP.NET Using HTTPHandler
http://msdn.microsoft.com/library/en-us/dnpatterns/html/ImpFrontControllerIn
ASP.asp?frame=true
And here are some other tech articles I've searched on the web:
#ASP.NET MVC Web-Tier
http://moncs.cs.mcgill.ca/people/hv/teaching/MSBDesign/codagen.pdf
Hope they're helpful.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx