在c#中指定cookie中的路径,域 [英] specify path ,domain in cookies in c#

查看:260
本文介绍了在c#中指定cookie中的路径,域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在c#中为特定域指定cookie的路径,以便只有该应用程序才能访问cookie。通过在应用程序中使用文件夹名称给出Cookie.Path来尝试,例如

/尝试/或/尝试但是它正在创建.AspxAuth。 cookie但用户无法登录,因为Current.user将为null。目前我在尝试使用localhost ..



我相信这是由于我提供的cookies路径。



请为localhost和Live网站提供详细的解决方案,例如: www.abc.com

I have to specify path for cookies for particular domain in c# So that cookies will be accessible to that application only. Tried out by giving Cookie.Path using Folder Name in application e.g.
/Try/ or /Try but it is creating ".AspxAuth" cookie but user is not able to login as Current.user is coming null. currently i am trying on localhost..

I am sure it is due to cookies path i am providing.

Please provide the solution in detail, for both localhost and for Live site e.g. www.abc.com

推荐答案

ASPXAUTH cookie用于确定用户是否经过身份验证。



因此,您可能有用户未经过身份验证,这就是为什么您将其作为 null

所以关注那个:)



-KR
The ASPXAUTH cookie is used to determine if a user is authenticated.

So there might be a possibility that you're User is not authenticated, that is why you're getting it as a null.
So focus on that :)

-KR


这篇关于在c#中指定cookie中的路径,域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆