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

推荐订阅源

N
News and Events Feed by Topic
D
Docker
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
F
Full Disclosure
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
L
LangChain Blog
H
Help Net Security
B
Blog
T
Tailwind CSS Blog
V
V2EX
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
美团技术团队
A
About on SuperTechFans
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
I
InfoQ
Project Zero
Project Zero
I
Intezer
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threat Research - Cisco Blogs
Last Week in AI
Last Week in AI
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
S
Securelist
Recorded Future
Recorded Future
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 叶小钗
S
Security Affairs
Blog — PlanetScale
Blog — PlanetScale
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
The Hacker News
The Hacker News

博客园 - wngwz

IP地址 - wngwz - 博客园 金额转换.小To大 - wngwz - 博客园 简,繁体转换工具. 弹出模态窗体,关闭后。重新绑定页面(这个仅仅是对粗心大意的纪录) - wngwz - 博客园 分页存储过程 关于水晶报表的版本问题! 大年30祝大家, 不知道说还要GMail的油箱! 打印的一些知识! 求助!水晶报表! 解决把水晶报表下载到客户端过程中,出现下载整个页面(.aspx)或者直接载web页中打开word文件的问题! 收获!关于引用计数器! 把文件或图片存在数据库中! 水晶报表倒出! 关于(学习!Excel)的问题。 解决问题总结 水晶报表操作中遇到的问题 javascript 打印报表! javascript 学习
单点登陆 - wngwz - 博客园
wngwz · 2006-02-08 · via 博客园 - wngwz

两个站点,登陆一个另外一个就不用登陆了。
站点1 A,站点2 B
A中的配置:
web.config中:

  <machineKey validationKey="DD305F238C8F26103323F10B1A655ED9FA7DBB7A" decryptionKey="70DE128000E565A7F8441A4C091C11EC8C5BB9B4D4EDA7A1" validation="SHA1"/>
  
<authentication mode="Forms"> 
   
<forms name=".ASPXFORAUTH" loginUrl="WebForm/Login.aspx" timeout="30" protection="All"></forms> 
  
</authentication>

登陆代码写成:

            FormsAuthentication.SetAuthCookie(txtUserName.Text.Trim(), False)
            Response.Redirect(
"Main.aspx"False)

如果要在不同的站点中通用一些数据信息,使用Cookies

            Dim ck As New System.Web.HttpCookie("login"'创建一个名为login的Cookie
            ck("loginid"= txtUserName.Text.ToUpper().Trim()  '一个cookie中可以存放若干个键值对.
            Response.Cookies.Add(ck)

B中的配置:
web.config中的配置:

    <!--<authentication mode="Windows" /> -->
    
<machineKey validationKey="DD305F238C8F26103323F10B1A655ED9FA7DBB7A" decryptionKey="70DE128000E565A7F8441A4C091C11EC8C5BB9B4D4EDA7A1" validation="SHA1"/>
    
<authentication mode="Forms">
        
<forms name=".ASPXFORAUTH" loginUrl="Login.aspx" timeout="20" protection="All"></forms>
    
</authentication>

登陆代码为:

                System.Web.HttpCookie ck = new HttpCookie("login");
                ck.Expires 
= System.DateTime.Now.AddMinutes(Session.Timeout);
                ck[
"loginid"= strLogin.ToUpper();
                Response.Cookies.Add(ck);
                System.Web.Security.FormsAuthentication.SetAuthCookie(txtUserName.Text.Trim(), 
false);
                Response.Redirect(
"main.aspx");

需要注意的是web.config中forms的name,应该一样。并且客户端允许使用cookies。