Hi John,
Based on my understanding, you have a virtual directory at
"/SessionManager" that is configured with AnonymousIdenti fication enabled.
However, you found that in Session_Start, Request.Anonymo usID is null. If
I've misunderstood anything, please feel free to let me know.
I've done some test on Windows Server 2003 R2 using the information from
your post, however, I found the AnonymousID is correctly set to a GUID
value (default).
Since AnonymousIdenti fication must be set at Machine.config, Root-level or
Application-level web.config, I think the setting should be honored in the
sub web.
As the documentation of AnonymousIdenti ficationModule' s event, the correct
event is Creating. The documention of AnonymousID is incorrect here. I'm
sorry for the confusion caused.
#How to: Create ASP.NET Application-Level Event Handlers
http://msdn2.microsoft.com/en-us/library/fwzzh56s.aspx
ASP.NET automatically binds application events to event-handler methods in
the Global.asax file using a naming convention of Application_eve nt, such
as Application_Beg inRequest and Application_Err or.
If you add modules to your application, the modules themselves can raise
events. The application can subscribe to in these events in the Global.asax
file by using the convention modulename_even tname. For example, to handle
the Authenticate event raised by a FormsAuthentica tionModule object, you
can create a handler named FormsAuthentica tion_Authentica te.
You will find following http modules in
%windir%\micros oft.net\framewo rk\v2.0.50727\c onfig\web.confi g:
<httpModules>
<add name="OutputCac he"
type="System.We b.Caching.Outpu tCacheModule" />
<add name="Session"
type="System.We b.SessionState. SessionStateMod ule" />
<add name="WindowsAu thentication"
type="System.We b.Security.Wind owsAuthenticati onModule" />
<add name="FormsAuth entication"
type="System.We b.Security.Form sAuthentication Module" />
<add name="PassportA uthentication"
type="System.We b.Security.Pass portAuthenticat ionModule" />
<add name="RoleManag er"
type="System.We b.Security.Role ManagerModule" />
<add name="UrlAuthor ization"
type="System.We b.Security.UrlA uthorizationMod ule" />
<add name="FileAutho rization"
type="System.We b.Security.File AuthorizationMo dule" />
<add name="Anonymous Identification"
type="System.We b.Security.Anon ymousIdentifica tionModule" />
<add name="Profile" type="System.We b.Profile.Profi leModule" />
<add name="ErrorHand lerModule"
type="System.We b.Mobile.ErrorH andlerModule, System.Web.Mobi le,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
</httpModules>
Which means you can use their events in Global.asax; and if you take a look
at AnonymousIdenti ficationModule' s events, it only has an event named
Creating.
You can use following code in global.asax to set the AnonymousID:
void AnonymousIdenti fication_Creati ng(object sender,
AnonymousIdenti ficationEventAr gs
args)
{
args.AnonymousI D = DateTime.Now.To String();
}
To debug this, make sure you've cleared IE cookies related to your web
server; you can use IECookiesView from
http://www.nirsoft.net/utils/iecookies.html to delete the cookies.
Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.