Server Error in '/' 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: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: 
[NullReferenceException: Object reference not set to an instance of an object.]
   hairprise.yy1.p_ServerClick(Object sender, EventArgs e) in c:\inetpub\wwwroot\happ1\yy1.aspx.cs:1000
   System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +108
   System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
   System.Web.UI.Page.ProcessRequestMain() +1277 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

解决方案 »

  1.   

    WEB共享吗?我设置了呀,
    到路径c:\inetpub\wwwroot\happ1
    我一开始就设置了happ1,右键击,然后选WEB共享,点添加,happ1;完成后:
    共享文件夹(S)
    /
    happ1
    难道我的设置有错吗?
      

  2.   

    这不显然是你happ1\yy1.aspx.cs:1000
    抛出的空引用异常吗?
      

  3.   

    我的.cs中,第1000行,只有一个conn.Close();难道我在一个Button()方法中,过多的使用conn.Open()和conn.Close();.net会不能承受吗?
    因为这个错实在是太奇怪了,同一个按钮,第十次,可能会报一次这样的错,
    第二十次,可能会报一个这样的错,没有规律可寻呀?
      

  4.   

    很简单,说明 conn 这个对象的值是 null
      

  5.   

    HtmlInputButton 执行时你根本没有先打开数据库连接
      

  6.   

    大哥,请指点什么叫做:HtmlInputButton 执行时你根本没有先打开数据库连接?
    虽然是一个HtmlInputButton,但我调用的是一个服务器端方法呀。不什么说根本没有先打开数据库连接呢?让在下很难找错的原因在于,就是这个按钮,它在大部分时间里,都是正常的,只是时不时的就给我来一个错误,没有规律性呀?真要命