A
Al Cohen
I'm attempting to build a templating engine that will substitute the
values of session variables for tags in a page before the page gets sent
to the client. For example, the contents of Session["UserName"] would
replace each instance of ${UserName} in the page just before the page is
returned.
In principle, this should be easy to do by hooking into one of the
HttpApplication events that occurs after the request handler runs, but
I'm having trouble figuring out exactly how. The problem is that to do
this, I need to satisfy two conditions:
1. I must have access to the Session
2. I must be able to manipulate (i.e., random search, delete, and write)
the page contents.
It looks like I can only manipulate the page contents in a filter
attached to HttpResponse.Response; otherwise, I can only append to the
Response. (Is this true?)
If I can only manipulate the page in a filter, that would be OK, as long
as the filter has access to the Session. However, a little
experimenting indicates that the Session is gone after
PostRequestHandlerExecute occurs, which is before the response filters
are executed.
So, I seem to be unable to manipulate the entire page and read a session
at the same time.
Any suggestions would be VERY appreciated!
Thanks,
Al Cohen
www.alcohen.com
values of session variables for tags in a page before the page gets sent
to the client. For example, the contents of Session["UserName"] would
replace each instance of ${UserName} in the page just before the page is
returned.
In principle, this should be easy to do by hooking into one of the
HttpApplication events that occurs after the request handler runs, but
I'm having trouble figuring out exactly how. The problem is that to do
this, I need to satisfy two conditions:
1. I must have access to the Session
2. I must be able to manipulate (i.e., random search, delete, and write)
the page contents.
It looks like I can only manipulate the page contents in a filter
attached to HttpResponse.Response; otherwise, I can only append to the
Response. (Is this true?)
If I can only manipulate the page in a filter, that would be OK, as long
as the filter has access to the Session. However, a little
experimenting indicates that the Session is gone after
PostRequestHandlerExecute occurs, which is before the response filters
are executed.
So, I seem to be unable to manipulate the entire page and read a session
at the same time.
Any suggestions would be VERY appreciated!
Thanks,
Al Cohen
www.alcohen.com