c#


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.

Related Links

How to check if View has received no results
SoapHeaderException being returned as (500) Internal Server Error. How do I fix it? [duplicate]
XmlSerializer reuse same class with different namespace
I am getting an error while passing query string of url between two pages
PRISM disable Journal
MigraDox C# Checkboxes - Wingdings Not Working
When i convert byte in string has a lot of unnecessary information c#
WCF REST service returns (400) Bad Request
Check If Xamarin Android App is connected to one of two networks
Remove “grant_type:password” from client side and transfer it to server side
Rename Default Result TAG from WCF Response
Passing Model data from View to Controller and using its values
save downloaded file to byte array in asp.net C#
BUG: Word 2013 VSTO Cannot Handle Image in Header Formatted Behind or In Front of Text
Move focus to checkbox after _onleave event
Using Livecharts Constant Changes example to plot points based on time, and readings from a serial port?

Categories

HOME
spring-boot
repository
leaflet
jenkins-pipeline
weblogic
abc
bigtable
spss
assign
datetimepicker
swap
richtextbox
qt4
handlebars.js
clip-path
revit-api
cracking
rename
tracking
javascript-debugger
openstack-horizon
react-jsx
coccinelle
combinations
poisson
datanucleus
inspec
smart-device
custom-fields
federated
opencsv
flickr
ninja-forms
ssdp
wicket-tester
glide-image-library
aura-framework
jenkins-2
runner
hdpi
jcs
vertex
reloaddata
catalyst
cedar-bdd
indoor-positioning-system
joystick
vga
shtml
laterjs
nd4j
apache2-module
wiql
adempiere
dpkt
targetprocess
fileinputstream
valdr-bean-validation
genero
indices
yosemite
tigase
worklight-appcenter
disparity-mapping
msdropdown
angular-file-upload
rails-migrations
new-operator
mixradio
backbone-views
codeigniter-form-helper
database-restore
wpml
expresso-store
jquery-ui-map
flatten
joomla1.7
capitalization
mscorlib
n2
noise-reduction
simultaneous
miniport
xslt-grouping
large-data-volumes
numerical-computing
ihtmldocument2
cstring
cross-cutting-concerns

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App