zoukankan      html  css  js  c++  java
  • asp.net 异常:Message="Value cannot be null.\r\nParameter name: g"

    ForumTableAdapters.tbTopicTableAdapter topic = new ForumTableAdapters.tbTopicTableAdapter();
                Response.Write(Request.QueryString["TopicID"].ToString());  后来加的测试行
                rpt_Topic.DataSource = topic.GetTopic(new Guid(Request.QueryString["TopicID"]));  错误提示所在行
                rpt_Topic.DataBind();

    错误具体信息

    System.ArgumentNullException was unhandled by user code
      Message="Value cannot be null.\r\nParameter name: g"
      Source="mscorlib"
      ParamName="g"
      StackTrace:
           at System.Guid..ctor(String g)
           at ShowTopic.Page_Load(Object sender, EventArgs e) in e:\SOLUTION\Forum\ShowTopic.aspx.cs:line 19
           at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
           at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
           at System.Web.UI.Control.OnLoad(EventArgs e)
           at System.Web.UI.Control.LoadRecursive()
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    上网查了好久,开始以为是iD什么的没写好,然后加断点,就在找g ,因为提示是g为null。最后看看trace,at System.Guid..ctor(String g)  ,终于找到g了,所以就是说,new Guid(Request.QueryString["TopicID"]))里面有问题。加了后来加的测试行之后,提示错误在新加的行,确定问题出在Request.QueryString["TopicID"】上。仔细检查代码,终于发现"&TopicID="写成了"&TopicID"少了=,所以提示为null,问题解决。

  • 相关阅读:
    Cannot find a free socket for the debugger
    maven自己创建jar坐标(比如oracle驱动包)
    svn“Previous operation has not finished; run 'cleanup' if it was interrupted“报错的解决方法
    java发http请求
    Spring MVC
    函数节流 防抖
    js 执行顺序
    铺平多维对象数组 js
    vue 线上图标404
    vue-devtools--------vue浏览器工具
  • 原文地址:https://www.cnblogs.com/bnuvincent/p/1524918.html
Copyright © 2011-2022 走看看