ASP.NET Authentication Provider (转)

ASP.NET Authentication Provider (转)[@more@]

ASP.NET Authentication Provider

XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" /> 

小气的神 2001-12-20

Article Type: Overview

难度等级:3/9 

版本:1.12

ASP.net 提供了一些新型的Authentication 和 Authorization 方案,对于开发人员来说这将是和以前不同的一种方式。可喜的是ASP.NET提供的方案多样更加灵活;可惜的是这种方案是基于IIS的。我知道,有些人并不喜欢IIS,认为它容易受攻击。只是一直不喜欢ASP的方式,杂乱的HTML标记中夹杂着代码,难于维护也难于调试。现在有了新的解决方案,让我们看看。

新型ASP.NET Authentication Provider(下面我会用ASP.NET AP来简称)仅仅发生在调用ASP.NET引擎执行.aspx文件时发生,这也意味着当调用.asp文件时将不会调用ASP.NET引擎。所有的Authentication选项被放在一个XML文件中。每当你创建一个ASP.NET的Project时,你可以在Project目录下发现一个Config.web文件,在这个XML文件的, , 等标记中你可以进行设置和控制。默认的是:,这意味着ASP.NET将不使用任何的Authentication Provider,那么这种模式下,ASP.NET的底层实现和原来的ASP和iis 4/5 将完全相同。

 

一个典型的Config.web的一般会是下面这样的:

<!--  AUTHENTICATION

 This section sets the authentication policies of the application. Possible modes are "windows", "Forms", "Passport" and "None"

--&gt

我们会逐一的考察中各个可能的值,不过作为一个开放人员最后我的重点会放在”Forms”上,最后确定一下我们的平台环境:W2K ADV , VS.NET RCx , ie 6 。(VS.NET Beta2 应该也是可以的,因为写这篇文章时我的系统已从Beta 2上升级了,所以只能说:我想Beta 2也是可以的。不过我们不会讨论mode=”Cookie”的情况,这个标记只发生在ASP+的情况下,Beta 2之后的ASP.NET中应当没有了),然后我们还会使用到SDK中带的例子,因为简单所以可以是最好的一个起点。

  然后我们需要简单的设置一下子,先建立一个目录C:InetpubwwwrootSecurity,然后Copy原来SDK的frameworkSDKSamplesQuickStartaspplussamplessecurity中的文件到新建的目录中(也可以直接解压缩附带文件到这个目录中)

1.  Mode=”None”

 

这种模式是默认的,像上面提到的那样,它的行为和原来的ASP没有任何的不同。

但你使用VS.NET生成一个ASP.NET 的Project时,这种模式是默认生成的。

 

2.  Mode=”Windows”

 

这种模式下,我们所访问的每一个页面都将需要通过系统的Authentication,访问者可能看到有些迷惑和Windows环境下特有的Authentication窗口 ,老实说我更喜欢看到 Window XP下的,它更可爱一些。使用这种模式意味着你可以不用额外的写任何代码,很快的实现,但我想你的商业用户不会喜欢它,而且作为一个开发人员,你无法定制它。

现在你实现这种方式将会非常的简单。

1.  在Config.web 文件中设置

2.  去IIS的控制管理界面设置你的Application属性就可以了。如下图:

3.  然后访问你的页面,你会看到这个对话框,很有趣但绝对让非专业人士迷惑。

4.  我们使用的是WindowAuth的页面。注意Mode=” Windows”,还没有先进到只用设置好Mode=就可以实现Windows Authentication了。

 

Windows Setupdotnet.51.net/jpg/02010901.jpg" align=baseline border=0>

 

结果如图:

 

3.  Mode=”Passport”

 

对于这种模式下,ASP.NET引擎会使用Microsoft Passport的Authentication机制,理论上这种模式将是最OK和省力的,不过照目前看来,想在ASP.NET下实现Passport还不是一件轻松的事情,VS.NET Beta 2的类库并没有完全实现Passport 2.1的功能(PassportIdentity). Microsoft目前唯一展示的是在MSDN上的ColdStorage例子,实现上基本基于Passport 1.4而且像使用DirectX 一样,还需要专门的一个DLL。有资料显示VS.NET RC2之后的类库已经实现了原来未实现的功能,但就目前看来缺少这方面的资料,所以把这方面的信息留给Microsoft和Passport 3.0吧,以后的时间我们会再来考察,对于Passport我深有信心,而且只要在Microsoft平台,我们都可能无法逃避面对Passport.

有关ColdStorage的Passport的信息,可以参见下面的文章:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncold/html/storageauthentication.asp

4.  Mode=”Forms”

 

这种模式下,我想每个开放人员将获得最大的灵活性和控制,而且从现在看来,这是最实用和可行的一种方式。先看一个比较简单的例子:

1.  在Config.Web 文件中进行下面的设置:

loginUrl=”string” 表明未通过Authentication的请求将被定向到的页面,你可以自行设置。

2.  然后点击或在login.aspx 文件的Login按钮的Click的事件处理程序中写入下面的代码:

void Login_Click(object sender, EventArgs E) {

// authenticate user: this samples accepts only one user with

// a name of new2001@msn.com and a password of 'ccBoy'

if ((UserEMail.Value == "new2001@msn.com") && (UserPass.Value == "ccBoy")) {

FormsAuthentication.RedirectFromLoginPage(Useremail.Value, PersistCookie.Checked);

}

else {

Msg.Text = "Invalid Credentials: Please try again";

}

}

这里我们使用的硬编码,目前只允许new2001@msn.com 和 ccBoy作为登录的用户。测试时我们并不直接访问Login.aspx而是请求default.aspx这个页面,ASP.NET使用其Authentication机制,将重新定向到Login.aspx,当用户输入的信息被接受则返回最初请求的default.aspx.方式上由于我们使用dotNET的WebUI控件,更加对象化了,当判断通过FormsAuthentication 执行RedirectFromLoginPage 方法,这个函数发出Cookie,并把用户重新定向到最初请求的资源。这种方式下ASP.NET AP做了一半的工作,事实上它是被动的完成RedirectFromLoginPage

结果如图:

下面我们修改config.web文件,使得Authentication 从config.web中获得信息和发生

1.  先设置config.web 文件

 

 

 

中指定访问系统资源的用户名和密码,并且可以对加密的密码进行定制和管理(建议实际应用中不要将用户名和密码放在这里面)

Passwordformat可以是“Clear”、“SHA1”、“MD5”等值。

Clear:用纯文本保存密码。用户和密码不需要进一步的转换可以直接使用和用户进行比较

SHA1:用SHA1的哈希分类保存密码。验证时将用SHA1算法对用户密码进行散列,然后同该值进行比较。

MD5:同SHA1类似,只是使用不同的算法。

当使用SHA1和MD5时还需要一个专门的api(HashPasswordForStoringInConfigFile)来执行加密,然后结果因保存到config.web文件中。具体可以参考下面的链接:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconformsauthenticationutilities.asp

2.  然后点击或在login.aspx 文件的Login按钮的Click的事件处理程序中写入下面的代码:

  void Login_Click(Object sender, EventArgs E) {

if ( FormsAuthentication.Authenticate( UserEmail.Value, UserPass.Value) )

{

  FormsAuthentication.RedirectFromLoginPage(UserEmail.Value, PersistCookie.Checked);

  }

  else {

   Msg.Text = "Invalid Credentials: Please try again";

  }

  }

  结果和上一个相同,但这次我们把判断交给了ASP.NET AP ,我们只传递了UserEmail,UserPass两个参数,Authenticate方法将完成Authentication过程,这个用户将和我们在config.web中中设置的相同。

  MS文档《Forms Authentication Using An XML Users File》展示了另外一种获取用户名和密码的方式,这种方式为了安全,用户和密码被放在一个单独的XML文件中。具体参考下面的链接:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconformsauthenticationutilities.asp

同样的道理你可以象你以前做得一样将用户和密码放到数据库表中,比如:

  void Login_Click(Object sender, EventArgs e) {

  if(Page.IsValid)

  {

  sqlDataReader dr;

 

  // Connect to the database

  SQLConnection cn = new SQLConnection("server=localhost;

  uid=myPassport;pwd=123;database=clientPassword;");

cn.Open();

  // Create a command to get the question

  SQLCommand cmdQuestion = new SQLCommand("select Password;

  FROM Users WHERE Email = '" + UserEmail.Value + "'", cn);

     

  cmdQuestion.Execute(out dr);

  if(dr.Read())

  if(dr["Password"].ToString() == UserPass.Value)

  FormsAuthentication.RedirectFromLoginPage(UserEmail.Value, PersistCookie.Checked);

  else

  Msg.Text = "Invalid password. Please try again ";

  else

  Msg.Text = "Email address not found.";

  }

  }

 

  再同理可以推到这个过程也还可以是调用带有商业逻辑 .net 组件来完成,也可以是调用另外一个Web Services来完成,当从这个角度来说,已经和MS Passport 有些相同了。相比起来Microsoft的方式是重量级的。

5.  Mode=”MyMode”

 

  这将是以后我们要讨论的,ASP.NET 支持我们使用自己的AP来实现Authentication 和 Authorization 方案.这将是一种更高级的方式,事实上ASP.NET 比上一个版本更加的灵活和多样的选择。Keith Brown在11,12月的MSDN Magazine上都有讨论有关ASP.NET 的安全性问题。

 

综上所述,我们可以看到一个基本的有关ASP.NET Authentication的情况,其好处是明显的,但如果你不喜欢IIS其本身,那么你也将考虑使用其他的Authentication方案。Jeff Kercher 的《ASP .NET 中的身份验证:.NET 安全性指导》将可以作为你开始和深入的一个更宏观的执导。

http://www.microsoft.com/china/msdn/library/dnbda/html/authaspdotnet.asp

这篇文章具体讲述了各种验证方案的环境和优劣,从而协助你选择和确定最佳的身份验证方法。

 

 


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-993642/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-993642/

相关推荐

MMRotate 详细使用教程

MMRotate 详细使用教程 做旋转目标检测,怎么可以不知道如何使用MMRotate呢! github链接: https://github.com/open-mmlab/mmrotate 1 安装 创建虚拟环境并激活 conda create -n mmrotate python=3.7 -y conda activate mmrotate 安装 PyTorch 和 torchvision conda install pytorch torchvision -c pytorch 注意:确保

Sylvia_Lan的博客 1万+

ASP.NET Authentication Provider(转)

ASP.NET 提供了一些新型的Authentication 和 Authorization 方案,对于开发人员来说这将是和以前不同的一种方式。可喜的是ASP.NET提供的方案多样更加灵活;可惜的是这种方案是基于IIS的。新型ASP.NET Authentication Pr

人生如旅 1002

台达B3伺服电机485通讯的调试过程

最近上了一项目,没办法直接把B3伺服接到PLC上去,怎么办?偶说试下直接电脑通过100多米的485线控制好了,定型前的测试就这样展开了。 1、焊CN1口 如果不安装CN1,是开不了机的,要报很多错误,比如SERV EMG ALERT, 上限报警,下限报警什么的,怎么办?直接焊好CN1头子吧,烦了点,但是必要的。 主要接的是11,9,10,32,31,30几个脚,按照图上连接好就是了。 2、 接线路 按照上面的图,接上伺服电机线,编码器线,电源线,包括限位常闭开关、485连线等,就完..

shidong01的博客 1万+

ASP.NET Authentication Provider

ASP.NET Authentication Provider  小气的神 2001-12-20 Article Type: Overview 难度等级:3/9        版本:1.12 ASP.NET 提供了一些新型的Authentication 和 Authorization 方案,对于开发人员来说这将是和以前不同的一种方式。可喜的是ASP.NE

ccBoy的专栏 2110

mysql 学习笔记(1):mysql 基本概念和 mysql workbench 的基本使用方法

…

qq_52740163的博客 1360

保姆级教程:在LKD3588开发板上为RK3588添加SC2210摄像头驱动(含完整DTS配置)

本文提供了一份详细的教程,指导如何在LKD3588开发板上为RK3588处理器添加SC2210摄像头驱动,包括完整的DTS配置和内核编译步骤。教程涵盖了环境准备、驱动文件添加、DTS配置详解、内核编译与烧录、驱动测试以及常见问题排查,帮助开发者快速实现SC2210传感器在RK3588平台上的集成与优化。

weixin_42641741的博客 485

在asp.net 2.0中使用自定义的provider

在asp.net2.0中,提供了各类的provider,有membership,role,profile等的,可以很方便地实现如角色,用户等管理,甚至不用自己写代码了。而在vs.net 2005中,默认的各类的provider是使用sql express的,有的时候,如果想使用sql sever2000或者sql server 2005,那应该怎么办呢?下面举例子说明:   首先,

324

最近腾讯手机管家a.gray.Bulimia.a病毒提示决解方案

仅供参考(个人问题已解决 未申诉) 用户反馈app提示病毒图如下 然后下载生产包去https://www.virustotal.com/gui/这个网站去检测 果真提示病毒 重新加版本 打了个包 未加固 检测没问有问题 同一个包用360加固之后再检测有问题 ,但是没有a.gray.Bulimia.a报病毒 然后再用应用宝加固检测也没问题,个人以前都是用360加固的,很尴尬啊 最重要的一点的是,更新一个版本号,其余的啥都没改,更新替换手机的原来版本app,腾讯手机.

村头那抠脚大叔的专栏 3万+

Security Tutorials系列文章第一章:Security Basics and ASP.NET Support

Security Tutorials系列文章第一章:Security Basics and ASP.NET Support 本系列链接如下: http://www.asp.net/learn/security/?lang=cs Security Tutorials系列文章第一章:Security Basics and ASP.NET Support 本文英文原版: h...

219

6、高通8155座舱平台--摄像头系统

在项目中遇到过,很多从手机转过来的工程师,上来就按手机那套调Camera,结果发现根本跑不通——为什么?我踩过这个坑——一开始想靠软件打时间戳来对齐,结果发现两个sensor的曝光时间不一样,时间戳根本对不上。我记得第一次调AWB时,怎么调颜色都不对,后来发现是BLC的参数没配好——黑电平偏了,后面所有颜色校正都是错的。上层应用说「我要拍张照」,HAL把它翻译成「ISP你给我处理这帧数据,sensor你给我曝光一次」。8155上推荐用camx,它是高通新一代的Camera框架,性能更好,而且支持多路同步。

woailuojp的博客 63

POSTMAN从入门到精通系列(十九):Cookie

饼干 Postman的本机应用程序提供MANAGE COOKIES模式,允许您编辑与每个域关联的Cookie。如果您想使用Postman Interceptor捕获cookie,请参阅捕获cookie部分。 前往cookie Manage 要打开MANAGE COOKIES模式,请单击“发送”按钮下的“Cookie”链接。 这将打开MANAGE COOKIES模式,并显示域列表和与...

u012014531的博客 1012

WCF 4 Step By Step Chapter 5 Note (Authentication in Internet)

When you start connecting client applications and services across a public network such as the Internet, you can no longer make any assumptions about the trustworthiness of client applications, servic

riverlau的专栏 747

vue2/3 - [超详细] 实现企业微信扫码登录完整流程及代码,vue项目接入企业微信扫码登录功能教程,支持新跳页显示二维码或div容器里内嵌登录二维码(详细代码注释,一键复制开箱即用)

vue企业微信扫码登录,vue网页网站企业微信扫码登录教程,vue如何实现企业微信扫码登录功能,vue详细企业微信扫码登录功能实现,vue2实现企业微信扫码登录,前端vue企业微信扫码登录教程,vue pc电脑端企业微信扫码登录详细教程,vue项目中怎么做企业微信扫码注册登录,vue实现网站接入企业微信扫码登录,vue2做企业微信扫码登录的优质文章教程,vue网站对接企业微信扫码登录,vue企业微信扫码登录如何新开一页全屏显示登录二维码,vue企业微信登录二维码 内嵌在div容器里/跳页显示登录二维码,vu

✅ 精选推荐文章 5705

在SharePoint Server 2016 RC 中利用ASP.Net SQL MemberShip和Role Provider为Web Application配置Forms-based身份验证

博客地址:http://blog.csdn.net/shelleyliu0415   概括介绍:基于Forms-based的身份验证是基于 ASP.NET Membership和Role provider 提供程序身份验证的基于Claims-Based的identity management系统,基于Forms-based authentication 根据用户在logon fo

为自己喝彩的博客 1582

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Custom Membership Provider under Minimal Trust in SharePoint 2007

转自:http://robgarrett.com/cs/blogs/default.aspx Overview  This document is a systematic instruction sheet for creating and installing an ASP.NET 2.0 Membership Provider into SharePoint 2007 B

maseccc的专栏 2044

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

ASP.NET Whidbey中personalization和membership的一些特征

在ASP.NET Whidbey中,一个基本的目标是,在开发应用程序时,减少开发时间和代码量。为了达到这一目的,ASP.NET Whidbey提供了一系列的新特征,例如无需代码的数据绑定,新的服务器端控件,尤其是,在这篇文章中要重点讨论的个人化(personalization)和成员角色(membership),来节省你的时间。伴随着个人化和成员角色这两个新特征,第一步是要配置你用来存储个人化

fielding的专栏 1090

ASP.NET Core 认证与授权(一):体系介绍

认证授权不是一个,也不是一段配置。对 Web API 来说,它是一套从登录开始、贯穿每次请求、一直延伸到续期和登出的机制。把所有内容塞进一篇文章,会让登录、JWT、Middleware、Policy、Refresh Token Rotation(刷新令牌轮换)互相抢重点。这篇先建立全局模型,知道每一步由谁负责;专题篇再把内部机制讲透。

实践出真知 473

ASP.NET Membership And Role Provider With Facebook

This is the second part of this article. This part will now demonstrate how to integrate the facebook connect to our existing website. Be sure to read the Part 1 of this article as we will be using th...

weixin_34227447的博客 389

Understanding the Forms Authentication Ticket and Cookie

http://support.microsoft.com/kb/910443 ASP.NET Support Voice Column Understanding the Forms Authentication Ticket and Cookie To customize this column to your needs, we want to invite you to s

riverlau的专栏 1161

FormsAuthentication 在asp.net MVC中的应用

说明:开发环境 vs2012 asp.net mvc4 c# 项目结构: 1、开发步骤 1.1 创建项目 打开vs2012 开发环境 “文件”--“新建”--“项目” 选择asp.net mvc项目类型 这里选择如下图示 1.2、添加Home,Login控制器 给Home,Login两个控制器的Index方法添加视图 web.config 配...

weixin_30311605的博客 1458

ASP.NET身份验证机制membership入门——项目

http://www.cnblogs.com/xlb2000/archive/2010/07/31/1788120.html ASP.NET身份验证机制membership入门——项目   前面说了很多关于membership的内容,感觉内容有点凌乱,内容都是一个个知识点,下面我们通过一个小的项目,来把所有的相关内容串一下。     首先描述一下需求:   我们要做一

191

Thanos 快速上手实战指南:从 Prometheus 单机到全局可查询、可长期存储的监控架构

**导读**:本文是 Thanos 项目的快速入门实战教程,面向已经跑着 Prometheus、但面临数据留存、多集群统一查询、高可用去重等问题的监控工程师。通过本文,你将掌握 Thanos 的核心组件(Sidecar、Querier/Query、Store Gateway、Compactor、Ruler/Rule、Receiver)各自的职责与部署方式,能够从零搭建一套“Prometheus 采

gitblog_00255的博客 1073
上一篇: Visual Studio .NET Enterprise Architect 中基于 Visio 的数据库建模:第一部分 (转)
下一篇: SVG:可升级矢量图形(1) (转)
csd3176
博客等级 码龄11年 20粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值