473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

anonymousIdentification setting fails to override root configurati

I am designing a site that requires AnonymousID. I set my web.config to
allow this using <anonymousIdentification enable="true".../as recommended
in the documentation.

To verify the settings I use the following code in global.asax and stop the
execution using debug to inspect the settings.

Configuration configuration =
WebConfigurationManager.OpenWebConfiguration("/SessionManager");

// Get the section.
AnonymousIdentificationSection anonymousIdentificationSection =
(AnonymousIdentificationSection)configuration.GetS ection("system.web/anonymousIdentification");

In this case anonymousIdentification is enabled.

When I get the root configuration using OpenWebConfiguration(null) and check
the settings anonymousIdentification is not enabled.

Subsequently when I check the Request.AnonymousID during page requests it is
null.

Another issue is which delegate to use to directly set the AnonymousID. The
documentation recommends both AnonymousIdentification_OnCreate and
AnonymousIdentification_Creating in different areas. I supplied both in my
global.asax code and neither are called further substantiating the failure to
use the site application web.config as opposed to the root web.config
settings.

Any suggestions or help is appreciated.
--
John H Clark
www.weownit.coop
Nov 14 '06 #1
6 4253
Hi John,

Based on my understanding, you have a virtual directory at
"/SessionManager" that is configured with AnonymousIdentification enabled.
However, you found that in Session_Start, Request.AnonymousID 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 AnonymousIdentification 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 AnonymousIdentificationModule'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_event, such
as Application_BeginRequest and Application_Error.

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_eventname. For example, to handle
the Authenticate event raised by a FormsAuthenticationModule object, you
can create a handler named FormsAuthentication_Authenticate.
You will find following http modules in
%windir%\microsoft.net\framework\v2.0.50727\config \web.config:

<httpModules>
<add name="OutputCache"
type="System.Web.Caching.OutputCacheModule" />
<add name="Session"
type="System.Web.SessionState.SessionStateModule" />
<add name="WindowsAuthentication"
type="System.Web.Security.WindowsAuthenticationMod ule" />
<add name="FormsAuthentication"
type="System.Web.Security.FormsAuthenticationModul e" />
<add name="PassportAuthentication"
type="System.Web.Security.PassportAuthenticationMo dule" />
<add name="RoleManager"
type="System.Web.Security.RoleManagerModule" />
<add name="UrlAuthorization"
type="System.Web.Security.UrlAuthorizationModule" />
<add name="FileAuthorization"
type="System.Web.Security.FileAuthorizationModule" />
<add name="AnonymousIdentification"
type="System.Web.Security.AnonymousIdentificationM odule" />
<add name="Profile" type="System.Web.Profile.ProfileModule" />
<add name="ErrorHandlerModule"
type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpModules>
Which means you can use their events in Global.asax; and if you take a look
at AnonymousIdentificationModule's events, it only has an event named
Creating.

You can use following code in global.asax to set the AnonymousID:

void AnonymousIdentification_Creating(object sender,
AnonymousIdentificationEventArgs
args)
{
args.AnonymousID = DateTime.Now.ToString();
}
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.

Nov 15 '06 #2
Walter,

Thanks for the information.

I checked my AnonymousIdentification module configuration and found that the
setting is as described in your reply. I retested after setting both the root
and the application anonymousIdentification enabled = "true". This has no
effect.

Please try testing the situation I described using XP Professional, Visual
Studio, IE7 in a localhost environment. See if that changes your outcome.
--
John H Clark
www.weownit.coop
"Walter Wang [MSFT]" wrote:
Hi John,

Based on my understanding, you have a virtual directory at
"/SessionManager" that is configured with AnonymousIdentification enabled.
However, you found that in Session_Start, Request.AnonymousID 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 AnonymousIdentification 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 AnonymousIdentificationModule'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_event, such
as Application_BeginRequest and Application_Error.

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_eventname. For example, to handle
the Authenticate event raised by a FormsAuthenticationModule object, you
can create a handler named FormsAuthentication_Authenticate.
You will find following http modules in
%windir%\microsoft.net\framework\v2.0.50727\config \web.config:

<httpModules>
<add name="OutputCache"
type="System.Web.Caching.OutputCacheModule" />
<add name="Session"
type="System.Web.SessionState.SessionStateModule" />
<add name="WindowsAuthentication"
type="System.Web.Security.WindowsAuthenticationMod ule" />
<add name="FormsAuthentication"
type="System.Web.Security.FormsAuthenticationModul e" />
<add name="PassportAuthentication"
type="System.Web.Security.PassportAuthenticationMo dule" />
<add name="RoleManager"
type="System.Web.Security.RoleManagerModule" />
<add name="UrlAuthorization"
type="System.Web.Security.UrlAuthorizationModule" />
<add name="FileAuthorization"
type="System.Web.Security.FileAuthorizationModule" />
<add name="AnonymousIdentification"
type="System.Web.Security.AnonymousIdentificationM odule" />
<add name="Profile" type="System.Web.Profile.ProfileModule" />
<add name="ErrorHandlerModule"
type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpModules>
Which means you can use their events in Global.asax; and if you take a look
at AnonymousIdentificationModule's events, it only has an event named
Creating.

You can use following code in global.asax to set the AnonymousID:

void AnonymousIdentification_Creating(object sender,
AnonymousIdentificationEventArgs
args)
{
args.AnonymousID = DateTime.Now.ToString();
}
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.

Nov 15 '06 #3
Hi John,

Make sure you've enabled "Anonymous access" in IIS for your virtual
directory.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 16 '06 #4
Walter,

The directory runs under the control of the ASP.NET Development Server. It
doesn't appear in the IIS list of virtual directories. Its URL is
http://localhost:xxxx/SessionManager.

How do I allow anonymous access to this virtual directory?
--
John H Clark
www.weownit.coop
"Walter Wang [MSFT]" wrote:
Hi John,

Make sure you've enabled "Anonymous access" in IIS for your virtual
directory.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 16 '06 #5
Hi John,

I'm sorry for my misunderstanding that you're using IIS instead of the
built-in development web server.

Based on my research, to make the built-in server to accept anonymous
login, you have to use either "None" or "Forms" authentication mode in
web.config:

<system.web>
<authentication mode="Forms"/>
...
</system.web>
Using "Windows" authentication mode will use current windows user account
to login; thus reading Request.AnonymousID will return null.

This is one of limitations of the built-in web server that is not
documented well. I'm sorry for the inconvenience.

The built-in web server does have many limitations when compared to IIS
server, you may find more information here:

#Web Servers in Visual Web Developer
http://msdn2.microsoft.com/en-us/lib...w5(VS.80).aspx
The ASP.NET Development Server only accepts authenticated requests on the
local computer. This requires that the server can support NTLM or Basic
authentication.

Security Context for the ASP.NET Development Server

An important difference between the ASP.NET Development Server and IIS is
the security context in which the respective servers run your ASP.NET
pages. This difference can affect your testing because of differences in
how the pages run.

When you run a page using the ASP.NET Development Server, the page runs in
the context of your current user account. For example, if you are running
as an administrator-level user, a page running in the ASP.NET Development
Server will have administrator-level privileges.
#File System Web Sites
http://msdn2.microsoft.com/en-us/lib...73(VS.80).aspx

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '06 #6
Walter,

Thanks for the information.

FYI, I am using Forms authentication so the situation is not resolved by
using Forms authentication.

I will test under the IIS environment.
--
John H Clark
www.weownit.coop
"Walter Wang [MSFT]" wrote:
Hi John,

I'm sorry for my misunderstanding that you're using IIS instead of the
built-in development web server.

Based on my research, to make the built-in server to accept anonymous
login, you have to use either "None" or "Forms" authentication mode in
web.config:

<system.web>
<authentication mode="Forms"/>
...
</system.web>
Using "Windows" authentication mode will use current windows user account
to login; thus reading Request.AnonymousID will return null.

This is one of limitations of the built-in web server that is not
documented well. I'm sorry for the inconvenience.

The built-in web server does have many limitations when compared to IIS
server, you may find more information here:

#Web Servers in Visual Web Developer
http://msdn2.microsoft.com/en-us/lib...w5(VS.80).aspx
The ASP.NET Development Server only accepts authenticated requests on the
local computer. This requires that the server can support NTLM or Basic
authentication.

Security Context for the ASP.NET Development Server

An important difference between the ASP.NET Development Server and IIS is
the security context in which the respective servers run your ASP.NET
pages. This difference can affect your testing because of differences in
how the pages run.

When you run a page using the ASP.NET Development Server, the page runs in
the context of your current user account. For example, if you are running
as an administrator-level user, a page running in the ASP.NET Development
Server will have administrator-level privileges.
#File System Web Sites
http://msdn2.microsoft.com/en-us/lib...73(VS.80).aspx

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bob Goldberg | last post by:
I'm a novice Unix user, and I can't get MySQL set up properly on my Mac. It seems to have installed OK, but when I try to run the mysql_install_ db script, I get errors. I can't set the root...
0
by: Johan | last post by:
Hi I'm using WMI to set and remove folderpermissions and it sems to work fine, sometimes. I start by having the folderpermissons manuly set to Everyone and Everone has full rights. When I'm...
3
by: Martin | last post by:
How does one set up basic authentication on an HttpListener? I know I need to set the HttpListener.AuthenticationSchemes to AuthenticationSchemes.Basic but then I'm unsure how and against what...
14
by: Dave Booker | last post by:
It looks like the language is trying to prevent me from doing this sort of thing. Nevertheless, the following compiles, and I'd like to know why it doesn't work the way it should: public class...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
by: tedqn | last post by:
As I attempted to use the built Profile feature to store some user info. <anonymousIdentification enabled="true" /> Whenever I set this flag, the db connection would fail, even though debug...
1
by: Khafancoder | last post by:
Hi guys, i'm trying to change all of page control's (root controls and inner controls) forecolor in PreRender event. it works fine but when a postback occures by detailsview command buttons, it...
6
by: itsolution | last post by:
Hi folks, Could you shed some light on this issue? my program is running on Freebsd as a daemon. When user sends a request, it forks itself and lets its child process handles the request....
1
by: =?Utf-8?B?UmljaA==?= | last post by:
In the Registry at HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Jet \ 4.0 \ Engines \ Text the default key for Text Format is: "Format" = "CSVDelimited" I can use the following OleDB...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.