我的web程序在本机上可以运行,把程序发布到我购买的空间上不能运行!提示如下:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
[NullReferenceException: 未将对象引用设置到对象的实例。]
   index.Page_Load(Object sender, EventArgs e) +47
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.3082; ASP.NET 版本:2.0.50727.3082 
该网站也说支持ASP.net2.0我对照了一下.net 的版本也是一样的,为什么不能运行了!

解决方案 »

  1.   

    发点原码上来,你的错好像在index页面的后台代码上,多半是你没有new对象造成
      

  2.   

    code=C#][/code]
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.SqlClient;   public partial class index : System.Web.UI.Page
       {
        protected void Page_Load(object sender, EventArgs e)
            {
                string userName = Request.Form.Get("username").ToString();
                string userpwd = Request.Form.Get("userpwd").ToString();            SqlConnection con = new SqlConnection("Server=.;database=login;uid=a1221094310;pwd=212042;");
                con.Open();
                SqlCommand cmd = new SqlCommand("select count(*) from login where userName='" + userName + "'and Userpwd='" + userpwd + "'", con);
                int count = Convert.ToInt32(cmd.ExecuteScalar());
                if (count > 0)
                //if (userName =="gxh"|| userpwd =="gxh")
                {
                    Response.Redirect("main.aspx?username=" + userName);
                }
                else
                {                Response.Redirect("loginfail.aspx");
                }  
                }
        }[
      

  3.   

                string userName = Request.Form.Get("username").ToString(); 
                string userpwd = Request.Form.Get("userpwd").ToString(); 你改用session试一试!
      

  4.   

    string userName = Request.Form.Get("username").ToString(); 
                string userpwd = Request.Form.Get("userpwd").ToString(); 打上断点看一下提取的值是多少,一步一步的调一下,看看在哪一步上错了
      

  5.   

    WEB.config里设置一下
    <customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>