aspnet_regsql命令创建需要的表结构

  public class UserProfile:ProfileBase
{
[SettingsAllowAnonymous(true)] //默认匿名用户不能访问
public string MyTest
{
get
{
return (string)base["mytest"];
}
set
{
base["mytest"] = value;
}
} }
   <system.web>
<compilation debug="true" targetFramework="4.0" />
<anonymousIdentification enabled="true"/>
<authentication mode="Forms">
<forms loginUrl="a.html"></forms>
</authentication>
<profile defaultProvider="mySqlProfileProvider" inherits="WebApplication1.UserProfile">
<providers>
<clear/>
<add name="mySqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" applicationName="aa.com" connectionStringName="aspnetdb" description="mySqlProfileProvider"/>
</providers>
<properties>
<add name="A" /> <!--默认是string类型,匿名用户能够访问-->
<add name="B" type="System.Int32"/>
<add name="C" allowAnonymous="false" />
<group name="lists">
<add name="a" type="int"/>
</group>
</properties>
</profile>
</system.web>
<connectionStrings>
<add name="aspnetdb" connectionString="Data Source=.;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=sa;Password=123" providerName="System.Data.SqlClient"/>
</connectionStrings>

在properties中添加的name会放到默认生成的对象ProfileCommon中,ProfileCommon默认继承ProfileBase,但是可以自定义Profile,此时ProfileCommon会继承自定义的Profile【如上文中的UserProfile】。Profile中的信息会持久化到指定的数据库中。

web.config中的profile的更多相关文章

  1. ASP.NET web.config中的连接字符串

    在ASP.NET的web.config中,可以用两种方式来写连接字符串的配置. <configuration> <appSettings> <add key=" ...

  2. 在Asp.Net MVC 中如何用JS访问Web.Config中appSettings的值

    应用场景: 很多时候我们要在Web.Config中添加appSettings的键值对来标识一些全局的信息,比如:调用service的domain,跳转其他网站页面的url 等等: 那么此时就涉及到了一 ...

  3. 【转载】App.config/Web.config 中特殊字符的处理

    写一个网站,遇到一个问题,发布以后,提示错误,但是即使打开错误提示(在web.config中打开),还是只提示错误,没提示什么地方错误,这让我知道了:是webconfig本身的错误,经过排除,是链接字 ...

  4. 因为此控件已在 web.config 中注册并且与该页位于同一个目录中

    在web.config文件配置了用户控件 <pages> <controls> <add tagPrefix="my" tagName="l ...

  5. 使用IConfigurationSectionHandler在web.config中增加自定义配置

    一. 场景    这里仅举一个简单应用的例子,我希望在web.config里面增加网站的基本信息,如:网站名称,网站版本号,是否将网站暂时关闭等.二. 基本实现方法1. 定义配置节点对应的类:Site ...

  6. web.config中配置页面出错后跳转指定错误页面

    每当用户访问错误页面时,会出现不友好的404错误,所以为了防止这种不友好,我们在web.config中的<system.web>节点下配置 <customErrors>,在出现 ...

  7. (译)利用ASP.NET加密和解密Web.config中连接字符串

    介绍 这篇文章我将介绍如何利用ASP.NET来加密和解密Web.config中连接字符串 背景描述 在以前的博客中,我写了许多关于介绍 Asp.net, Gridview, SQL Server, A ...

  8. ASP.Net Web.config 中引用外部config文件

    1. 前提准备: Web.config file: <?xml version="1.0" encoding="utf-8"?><config ...

  9. 利用ASP.NET加密和解密Web.config中连接字符串

    摘自:博客园 介绍 这篇文章我将介绍如何利用ASP.NET来加密和解密Web.config中连接字符串 背景描述 在以前的博客中,我写了许多关于介绍 Asp.net, Gridview, SQL Se ...

随机推荐

  1. csv 导入到 access中去

    Csv中有500万数据,导入到Access中去,每6万条数据为1Table 先是参照着http://support.microsoft.com/kb/257819/zh-cn来写 1.找不到可安装的  ...

  2. dom的element类型

    1)getElementById 后面的nodeName和tagName都一样 var a=document.getElementById("my_div"); console.l ...

  3. AJAX 跨域

    1.说到ajax就会遇到的两个问题 1.1AJAX以何种格式来交换数据                    1.自定义字符串 2.XML描述 3.JSON描述(建议使用)          1.2如 ...

  4. Symfony2源码分析——启动过程2

    文章地址:http://www.hcoding.com/?p=46 上一篇分析Symfony2框架源码,探究Symfony2如何完成一个请求的前半部分,前半部分可以理解为Symfony2框架为处理请求 ...

  5. Python实现合并排序MergeSort

    def merge(sort_list, start, mid, end): left_list = sort_list[start:mid] right_list = sort_list[mid:e ...

  6. 本原串(HDU 2197 快速幂)

    本原串 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...

  7. JAVA_build_ant_mapper

    ant里面mapper的详细用法   ant里面mapper标签是和fileset配合使用的,目的就是把fileset取出的文件名转成指定的样式.其实看懂官方文档后,感觉真心没啥好写的.但是还是写一下 ...

  8. 解决“您必须先更新GOOGLE play才能运行此应用”的问题

    可以手机FQ然后更新,但是这样更新速度很慢,而且google商店上面的版本还是老版本. 正确的方法:去https://www.pushbullet.com/channel-popup?tag=am21 ...

  9. loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法总结

    loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法总结   首先,区别程序化初始viewcontroller,半程序化 ...

  10. ServletConfig对象 【通过此对象获取到web.xml中的信息】

    用途:       1)想让当前的Servlet读取一些在web.xml文件配置的初始化参数时,                      可以使用ServletConfig对象,他是Servlet运 ...