匿名用户开启个性化设置

    默认情况,ASP.NET2.0没有开启匿名用户个性化设置,通过Web.config设置,可以实现对匿名用户的支持。
    Web.config设置

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  
<appSettings/>
  
<connectionStrings/>
  
<system.web>
    
<anonymousIdentification enabled="true"/>
    
<profile>
      
<properties>
        
<add name="Name" allowAnonymous="true" />
        
<add name="LastSubmit" type="System.DateTime" allowAnonymous="true"/>
        
<group name="Address">
          
<add name="City"  allowAnonymous="true"/>
          
<add name="ZipCode"  allowAnonymous="true"/>
        
</group>
      
</properties>
    
</profile>
    
<compilation debug="true"/>
    
<authentication mode="Windows"/>
  
</system.web>
</configuration>

    anonymousIdentification:针对应用程序授权配置匿名标识。这是在需要授权时,对没有经过身份验证的实体进行标识所必需的。
    allowAnonymous必须设置为"True"。

   
Default.aspx.cs

    以上代码出于《asp.net2.0开发指南》。
posted on 2006-10-25 10:31  头发乱了  阅读(558)  评论(0编辑  收藏  举报