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

推荐订阅源

N
News and Events Feed by Topic
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
Jina AI
Jina AI
H
Help Net Security
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Vercel News
Vercel News
L
LangChain Blog
Recorded Future
Recorded Future
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
GbyAI
GbyAI
B
Blog RSS Feed
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
M
MIT News - Artificial intelligence
爱范儿
爱范儿
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Y
Y Combinator Blog
B
Blog
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
MongoDB | Blog
MongoDB | Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
The Cloudflare Blog
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
D
DataBreaches.Net
博客园 - 【当耐特】
T
Troy Hunt's Blog
V
Visual Studio Blog
V2EX - 技术
V2EX - 技术
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google Online Security Blog
Google Online Security Blog
The GitHub Blog
The GitHub Blog

博客园 - 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>