Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Major mixup in two ASP.NET transactions
Message
 
To
03/09/2006 11:13:08
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01150471
Message ID:
01150643
Views:
30
It sounds like you're looking for static/shared properties. Static constructors are guaranteed to fire only once.

HttpApplication is not a single instance. There are a many HttpApplication instances (which is what global.asax is) that are served from a pool so anything you attach to HttpApplication that is not static will have multiple instances.

This might help in understanding how the pipeline works:

http://www.west-wind.com/presentations/howaspnetworks/howaspnetworks.asp


+++ Rick ---

>>Don't think that would work. You've always got just the one instance of your framework object that's potentially being hit from multiple threads. You could map your framework oRequest/oResponse properties to the current objects e.g:
>>
>>  Public Property oResponse
>>        Get
>>           Return HttpContext.Current.Request
>>        End Get
>>   End Property
>>
>>
>>In the end, when you make a call to your framework object, you cannot assume that any per-request based information in it relates to the request actually making the call. In fact I think you have to address the general concurrency issues - all methods of the framework would need to be threadsafe (maybe Application.Lock()?) - and that's another performance hit (not sure about this - I've a feeling that HttpApplication itself is threadsafe to some degree but I've no documentation to hand).
>>
>>I hate to say it but, although you could get this to work, I think it would be wise to rethink the design of the application...
>
>Is the application factory the only way to achieve this? I have seen numerous examples on the net using the global.asax approach such as I did. I guess most of them never tested it in production with simultaneous hits. The goal here is to have the Initilaze() method of the framework to be initialized once. As this takes some time, and all the initialization in there, I need to make sure it will only be initialized once. Then, on upcoming hits, I need to start from that object but have to find a way to have everything from that point to be proprietary to the current hit. I guess the application factory would be the only way to achieve that. What do you think?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform