如果VisualBasic中的Web应用程序中的VisualStudio重新启动ASP.NET饼干不persiting [英] ASP.NET cookies not persiting if VisualBasic web app is restarted in VisualStudio

查看:148
本文介绍了如果VisualBasic中的Web应用程序中的VisualStudio重新启动ASP.NET饼干不persiting的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在跑的VisualStudio我的web应用程序,并设置cookies,它们不存在,如果我结束Web应用程序,然后再次运行它。

下面是我的cookie设置和获取功能:

(是用户信息的特殊或任意?)

 '设置的Cookie cookie_name到cookie_value。
子set_cookie(cookie_value,cookie_name)
    response.Cookies(用户信息)(cookie_name)= cookie_value
    response.Cookies(SOFTWARE_PROGRAM_NAME).Expires = datetime.now.adddays(365 * 10)
分结束
返回使用网站名为cookie_name。
功能get_cookie(BYVAL cookie_name为字符串)
    如果Request.Cookies时(用户信息)是没有那么
        返回
    其他
        cookie_value = Server.HtmlEn code(Request.Cookies时(用户信息)(cookie_name))
        回报cookie_value
    万一
最终功能


解决方案

这是因为你有效查杀Web服务器。这会从内存中包括饼干擦的所有变量。

尝试将其部署到IIS。

If I run my web app in VisualStudio, and set cookies, they aren't there if I end the web app and run it again.

Here are my cookie set and get functions:

( Is "userInfo" special or arbitrary? )

' Sets cookie cookie_name to cookie_value.
sub set_cookie( cookie_value , cookie_name  )
    response.Cookies( "userInfo" )( cookie_name ) = cookie_value 
    response.Cookies( SOFTWARE_PROGRAM_NAME).Expires = datetime.now.adddays(365*10)
end sub


' Returns cookie named cookie_name.
function get_cookie( byval cookie_name as string ) 
    If  Request.Cookies("userInfo") Is Nothing Then
        return ""
    else
        cookie_value =  Server.HtmlEncode(Request.Cookies( "userInfo" )( cookie_name ))
        return   cookie_value
    end if
end function

解决方案

This is because you're effectively killing the web server. This is going to wipe all variables from memory including cookies.

Try deploying it to IIS.

这篇关于如果VisualBasic中的Web应用程序中的VisualStudio重新启动ASP.NET饼干不persiting的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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