ASP.NET Webforms IHttpModule Singleton
I have a class that implements IHttpModule in a separate assembly from a website. The module implementation intercepts requests and rewrites urls for the website. The mappings are stored in a class with the requested url and the destination url. Is the second example, MTSingleton, from http://devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=486 suitable for creating the mapping list? Is there a better approach from within the module implementation? Edit: My bad, this is for IIS 6.0 and .NET 3.5 SP1
Sounds like you're looking to create the mappings object once in your app cycle. It sounds like you're trying to prevent this from being created over and over per request. (Please clarify if I'm wrong.) Look at the methods on IHttpModule. Assuming you're working with IIS 7.0, the ASP.Net lifecycle will show that the Init() method is fired once. Meaning, it's fired once per application lifecycle. So, fire up the web server, first request will kick Init() into gear, then subsequent requests don't need to fire it until the web server application cycle is refreshed. You should be able to safely move your mappings creation code into the Init() method, which should provide you with the safeguards you're seeking with a multi-threaded singleton type of initialization. You should still have multi-threaded safeguards around your mapping object, but the IHttpModule's Init() method should give you the fire-once-and-done effect you're seeking.
How can i scale a cube to only one direction left?
Why delegate declaration requires identifier to be mentioned?
Unable to find database name using EntityCommandExecutionException
How to Ignore the list if values are empty in c#
Why is Async Void so bad? [duplicate]
One ViewModel two Views with MVVMLight in WPF
Find n-level nested SubDocument MongoDB
Open asp LinkButton in a new tab
Creating a Font using Floating Point Size returns incorrect Sized Font
System.Web.HttpUtility.HtmlDecode giving different results
C# binding datagridviewcomboboxcolumn to list display, formatting, preferred Size error
How to design my online Game Server for Unity3d?
Decrypt C#-encrypted data in C++ using Windows AES crypto provider
What is the replacement of CryptoConfig class in .NETCore?
C# Service Reference error: A child element named 'element' with same key already exists
How to remove broken background of ListViewItem In UWP?