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

推荐订阅源

Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
U
Unit 42
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
B
Blog RSS Feed
Vercel News
Vercel News
F
Fortinet All Blogs
Know Your Adversary
Know Your Adversary
T
Troy Hunt's Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
Jina AI
Jina AI
小众软件
小众软件
T
Threatpost
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
Scott Helme
Scott Helme
B
Blog
腾讯CDC
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
S
Schneier on Security
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
K
Kaspersky official blog
G
Google Developers Blog
T
Tor Project blog
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
Latest news
Latest news
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
罗磊的独立博客

博客园 - 海潮的博客

用DOS命令安装删除服务 - 海潮的博客 - 博客园 安装好PHP之后一般要找到php安装目录,修改php.ini中的时区设置 让Serv-u 9永远停留在30天试用的方法 请问SharePoint高手,怎样开发一个类似查阅项的字段类型?(无奈求助,请保留一两天) Static Ip on Windows PE 2 查看windows端口的使用 (抄录的) 不得不在这里求助了,NBear是不是没有TableAttribute属性了? vista 下安装了 vs2005及vs2005 sp1,但是还是出现“要运行 visual studio 2005 sp1,建议使用管理员权限” 解决ajax.net 1.0中文乱码问题! 一个上传大文件的部件叫做:SlickUpload-2.5.3 删除重复记录的办法 CSS解决未知高度垂直居中的问题 未知大小图片在已知容器中的垂直和水平居中问题 安装 Atlas 时遇到一个小问题 我儿子 如何在本机上开发支持二级域名的.NET系统 二级域名共享cookies ASP.NET中实现二级或多级域名(修改UrlRewrite) 一个图片轮换效果的JS
Cookie 支持二级域名和FormsAuthentication 加强版
海潮的博客 · 2006-07-25 · via 博客园 - 海潮的博客

因为FormsAuthentication验证方式,生成的Cookie的Domain是当前路径中的Domain,并不支持二级域名,所以在

.Text 支持二级域名之二 http://thinhunan.cnblogs.com/archive/2005/10/27/262749.html  一文中,我使用了一种在每处调用SetAuthCookie和SignOut方法时更改写入的Cookie的Domain的方法来使其支持二级域名。

这种方法可行,但有些麻烦。后来又发现更有效更便捷的一种方法,那就是利用HttpModule


public class SecondaryDomainCookieModule : System.Web.IHttpModule
{
    
public SecondaryDomainCookieModule(){}

    
public void Dispose(){}

    
public void Init(System.Web.HttpApplication context)
    
{
        context.EndRequest 
+=new EventHandler(cookie_Edit_EndRequest);
    }


    
private void cookie_Edit_EndRequest(object sender, EventArgs e)
    
{
        HttpContext context  
= ((HttpApplication)sender).Context;

        
string domain = ".tzl.com";
        
string cookieName =  FormsAuthentication.FormsCookieName;
        HttpCookie cookie 
= context.Response.Cookies[cookieName];
        
if(cookie != null)
        
{
            cookie.Domain 
= domain;
                    
        }

        
    }

}

posted @ 2006-07-25 11:21  海潮的博客  阅读(362)  评论(0)    收藏  举报

刷新页面返回顶部