惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 00654

阳光已经好久不见 我这里有漂亮的繁体字,非主流图片 编写第一个JavaScript程序 - 00654 - 博客园 sql语句实现模糊搜索 反回上一页并刷新! - 00654 - 博客园 自己写的一个分页代码。写得不好哈! 取得页面执行时间的代码 - 00654 - 博客园 Java脚本提示用户是否确定操作。否则取消当前操作。 - 00654 - 博客园 checkbox控件.全选与不全选的切换 - 00654 - 博客园 用JavaScript判断用户输入的数据是否如何要求! - 00654 - 博客园 [asp.net]Forms验证初步 SQL SERVER 函数 Scott Mitchell的ASP.NET2.0数据指南中文版索引 (好教程) Asp.Net 函数,方法。不断添加中。。 ASP.Net中控件的EnableViewState属性 ObjectDataSource控件的使用... Sql存储过程和函数集合.(不断更新中....) Select嵌套查询.(子查询取得其他表字段的值.并显示在本次查询的结果) DateReader,DateAdapter,DateSet和SqlCommand的基本使用方法
用Forms做管理员登陆。。。
00654 · 2006-12-19 · via 博客园 - 00654
 

//判断用户名是否正确。。
string User,Pass;
        User=user.Text;
        Pass=pass.Text;
        Iindex iindex = new index();
        if (User == ""){ Label1.Text = "管理员用户名不能为空!"; }
        else
        {
            if (Pass == "") { Label1.Text = "管理员密码不能为空!"; }
            else
            {
                if (iindex.admingo(User, Pass))
                { FormsAuthentication.RedirectFromLoginPage(User, false); } //正确。允许访问保护文件。
                    
                else
                {
                    Label1.Text = "登陆失败.请确认用户和密码是否输入正确!";
                }
            }
        }

HttpContext.Current.User.Identity.Name; //得到当前登陆的用户名。。
System.Web.Security.FormsAuthentication.SignOut();  注销登陆 

web.config文件配置。

<?xml version="1.0"?>
<!--
    注意: 除了手动编辑此文件以外,您还可以使用
    Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
     “网站”->“Asp.Net 配置”选项。
    设置和注释的完整列表在
    machine.config.comments 中,该文件通常位于
    \Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
 <connectionStrings>
  <add name="Data" connectionString="Data Source=127.0.0.1;Initial Catalog=Sf00654;User ID=sa;Password=4501550"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
 <appSettings/>
 <system.web>
  <compilation debug="true"/>
    <!--=========================================================================================设置为窗体身份验证方式...-->
    <authentication mode="Forms" >
      <forms loginUrl="Admin/index.aspx" protection="All" timeout="360" name=".ASPX00654" requireSSL="false" cookieless="UseDeviceProfile" defaultUrl="admin/admin_index.aspx">
      </forms>
    </authentication>
    <!--=========================================================================================-->
  </system.web>
  <location path="Admin">  <!--受保护的文件夹-->
    <system.web>
      <authorization>
        <deny users="?"></deny>
        <!--这是一个授权节,此节设置应用程序的授权策略。可以允许(allow)或拒绝(deny)不同的用户或角色访问应用程序资源。
        通配符: "*" 表示任何人,"?" 表示匿名(未经身份验证的)用户。看我们上面的设置知道,这样配置就是拒绝未经身份验证的用户访问。-->
      </authorization>
    </system.web>
  </location>
  <!--=========================================================================================-->
</configuration>