首页 \ 问答 \ 什么是防止会话劫持的最佳方法?(What is the best way to prevent session hijacking?)

什么是防止会话劫持的最佳方法?(What is the best way to prevent session hijacking?)

具体来说,这是关于何时使用客户端会话cookie来标识服务器上的会话。

是对整个网站使用SSL / HTTPS加密的最佳答案,您有最好的保证,中间人员中没有人能够嗅探现有的客户端会话cookie?

也许第二好使用存储在会话cookie中的会话值本身使用某种加密?

如果恶意用户对机器进行物理访问,他们仍然可以查看文件系统来检索有效的会话cookie,并使用它来劫持会话?


Specifically this is regarding when using a client session cookie to identify a session on the server.

Is the best answer to use SSL/HTTPS encryption for the entire web site, and you have the best guarantee that no man in the middle attacks will be able to sniff an existing client session cookie?

And perhaps second best to use some sort of encryption on the session value itself that is stored in your session cookie?

If a malicious user has physical access to a machine, they can still look at the filesystem to retrieve a valid session cookie and use that to hijack a session?


原文:https://stackoverflow.com/questions/22880
更新时间:2023-12-07 19:12

最满意答案

在项目中添加一个引用,并在CS文件的顶部使用using子句。

添加引用:

  1. 在Visual Studio中,单击项目,然后单击添加引用。
  2. 单击浏览选项卡,找到要添加引用的DLL。
    注意:如果要使用的DLL在同一个项目中,显然使用浏览是不好的形式。 而是右键单击项目,然后单击添加引用,然后从项目选项卡中选择相应的类:
    在此输入图像说明
  3. 单击确定。

添加using子句:

添加“使用[namespace];” 到您要引用库的CS文件。 因此,如果要引用的库有一个名为MyLibrary的命名空间,请将以下内容添加到CS文件中:

using MyLibrary;

Add a reference to it in your project and a using clause at the top of the CS file where you want to use it.

Adding a reference:

  1. In Visual Studio, click Project, and then Add Reference.
  2. Click the Browse tab and locate the DLL you want to add a reference to.
    NOTE: Apparently using Browse is bad form if the DLL you want to use is in the same project. Instead, right-click the Project and then click Add Reference, then select the appropriate class from the Project tab:
    enter image description here
  3. Click OK.

Adding a using clause:

Add "using [namespace];" to the CS file where you want to reference your library. So, if the library you want to reference has a namespace called MyLibrary, add the following to the CS file:

using MyLibrary;

相关问答

更多
  • 如果F#环境可以找到Rdiosharp.dll的位置,则以下代码Rdiosharp.dll 。 通常不会! 所以它不起作用,并告诉你“错误FS0084:程序集引用”RdioSharp.dll“未找到或无效”。 #r "RdioSharp.dll" 您可以提供此dll的确切路径,如下所示: #r @"c:\temp\RdioSharp.dll" 或者您可以将其文件夹添加到搜索路径中: #I @"c:\temp" The following code works if F# environment can ...
  • 您需要添加一系列C# 平台调用方法定义。 这告诉C#如何调用.dll,并直接使用C API。 标题和库文件完全没有使用。 You need to add a series of C# Platform Invocation method definitions. This tells C# how to call into the .dll, and use the C API directly. The header and library files are completely unused.
  • 在项目中添加一个引用,并在CS文件的顶部使用using子句。 添加引用: 在Visual Studio中,单击项目,然后单击添加引用。 单击浏览选项卡,找到要添加引用的DLL。 注意:如果要使用的DLL在同一个项目中,显然使用浏览是不好的形式。 而是右键单击项目,然后单击添加引用,然后从项目选项卡中选择相应的类: 单击确定。 添加using子句: 添加“使用[namespace];” 到您要引用库的CS文件。 因此,如果要引用的库有一个名为MyLibrary的命名空间,请将以下内容添加到CS文件中: usi ...
  • 我认为这是一个com可见的.net程序集,你应该直接添加.net程序集作为.net组件。 您链接的技术是如何编写可以从VB6引用的.net程序集。 无需将其添加为.net项目的com引用,只需将其添加为普通的.net引用即可。 I think it is saying it is a com visible .net assembly and you should add the .net assembly directly as a .net assenbly. The technique you lin ...
  • 您链接的页面中的说明建议您在添加引用时浏览到库的已编译DLL。 我不知道他们为什么会这么推荐。 有点奇怪。 只有当库的编译二进制文件是你所拥有的时候才应该使用它。 通常的建议做法是将两个项目(库和使用该库的项目)添加到同一解决方案中,这样您就可以在Visual Studio中一起编辑它们,并将它们一起编译。 然后,在“ 添加引用”对话框中,使用“ 项目”选项卡而不是“ 浏览”选项卡,该选项卡将列出您的库。 这样,您的代码将始终了解库中的所有最新更改。 如果在库中声明一个新类型,则可以立即在另一个项目中使用它 ...
  • 不要忘记这篇文章 ,通过注册课程来引导你。 Not to forget this post that steps you thru registering the class.
  • 您可以创建一个DLL,在其中为.lib中的每个函数创建包装函数: extern "C" __declspec (dllexport) HANDLE OpenFile(char const * filename) { return open_file(filename); } 在C#中,您使用P / Invoke使dll函数可用: [DllImport("WrapperLib.dll")] private static extern System.IntPtr OpenFile(string fil ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)