使用焦炭的问题? [英] problem in use cokees?

查看:107
本文介绍了使用焦炭的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有

i我正在使用这样的cokees然后它工作正常这是登录页面并在其他页面上重定向工作正常



  Dim  cokee  As  HttpCookie 
cokee = HttpCookie( userinfo
< span class =code-comment>' cokee.Expires = DateTime.Now.AddDays(30)
cokee( name)= 欢迎:& vbTab& reader( fname)& vbTab& reader( lname
Response.Cookies.Add(cokee)
Response.Redirect( jobdetail.aspx



读取可乐的第二页代码

  Dim  cokee 作为 HttpCookie = Request.Cookies(  userinfo
lblogin。 Text = cokee( name







但是当我关闭broswr和过去的旧链接时我有问题

http://localhost:1034/job%20online/jobdetail.aspx [ ^ ]

当我通过此浏览器时给出此信息错误

'/ job online'应用程序中的服务器错误。 
---------------------------------------------- ----------------------------------

对象引用未设置为的实例一个东西。
描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.NullReferenceException:未将对象引用设置为对象的实例。

源错误:

生成此未处理异常的源代码只能在调试模式下编译时显示。要启用此功能,请按照以下步骤之一,然后请求URL:

1.在生成错误的文件顶部添加Debug = true指令。示例:

<%@ 语言 = C# 调试 = true %>

或:

2)将以下部分添加到应用程序的配置文件中:

< 配置 >
< system.web >
< 编译 debug = true / >
< / system.web >
< / configuration >

请注意,第二种技术将导致给定应用程序中的所有文件都以调试模式进行编译。第一种技术只会导致在调试模式下编译该特定文件。

重要:在调试模式下运行应用程序会产生内存/性能开销。在部署到生产方案之前,应确保应用程序已禁用调试。

堆栈跟踪:

解决方案

首先应检查cookie是否存在。

 如果  Request.Cookies(  userinfo  没什么 然后 
' 代码,如果cookie不存在
Dim cokee As HttpCookie = Request。 Cookies( userinfo
lblogin.Text = cokee( name
结束 如果


dear all
i am using cokees like this and then it works fine this is login page and redirect on other page works fine

Dim cokee As HttpCookie
               cokee = New HttpCookie("userinfo")
               'cokee.Expires = DateTime.Now.AddDays(30)
               cokee("name") = "Welcome:" & vbTab & reader("fname") & vbTab & reader("lname")
               Response.Cookies.Add(cokee)
               Response.Redirect("jobdetail.aspx")


second page code to read cokees

Dim cokee As HttpCookie = Request.Cookies("userinfo")
       lblogin.Text = cokee("name")




but problem when i closed broswr and past old link as i copy
http://localhost:1034/job%20online/jobdetail.aspx[^]
when i past this browser give this error

Server Error in '/job online' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:

解决方案

You should first check if cookie exists or not.

If Not Request.Cookies("userinfo") Is Nothing Then
    'Code if cookie does not exist
    Dim cokee As HttpCookie = Request.Cookies("userinfo")
    lblogin.Text = cokee("name")
End If


这篇关于使用焦炭的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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