开发者

Pass data to a HttpModule

开发者 https://www.devze.com 2022-12-22 03:31 出处:网络
I have a funny little situation on my hands. I have a httpModule on my hands that I have to feed with context relative data.

I have a funny little situation on my hands.

I have a httpModule on my hands that I have to feed with context relative data.

That means that on the page I have to set something that the HttpModule can then react on. If possible I would like to avoid having call context data in the session.

Any bright ideas out there.

thx for the answer.

Edit: The HttpModule is working as a last minute interceptor. And my problem is that I am looking for a cleaver way 开发者_StackOverflow中文版of telling the HttpModule to:

  1. Intercept this call (changes dynamically, so can not be statically configured)
  2. Do some secret stuff with the data that I would like to pass to it
  3. Somehow make that action idempotent. Because it must not happen twice regardless of user actions and possible system errors.


What do you mean you would like to avoid "having call context data in the session"?

HttpContext is different to session, in the fact that it only lasts for the duration of the request. Session as its name suggests lasts for the entire session (which might include multiple requests).

It might be a clean solution to use HttpContext as that is what it is there for.

Regards,

David

Update: Should have mentioned you can access the current context via HttpContext.Current.Items.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号