服务器错误'/'应用程序运行时错误 [英] Server Error in '/ ' Application Runtime error

查看:273
本文介绍了服务器错误'/'应用程序运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想在单击消息链接时重定向Message.aspx页.当我单击消息发送按钮时,我收到一个错误,例如"/"应用程序中的服务器错误.在我的应用程序中,我使用了Ajax代码.
请帮帮我.

功能展示(网址)
{

如果(window.XMLHttpRequest)
  {//  IE7 +,Firefox,Chrome,Opera,Safari的代码
  xmlhttp =  XMLHttpRequest();
  }
其他
  {//  IE6,IE5的代码
  xmlhttp =  ActiveXObject(" );
  }
xmlhttp.onreadystatechange = function()
  {
  如果(xmlhttp.readyState ==  4 && xmlhttp.status == " ).innerHTML = xmlhttp.responseText;

    }
  }
xmlhttp.open(" ,URL, true );

xmlhttp.send();
}


消息

Message.aspx页面中的代码

 DateTime date = System.DateTime.Now;
            字符串 strquery = "  + StudId +  ','" + ddlReceiver .SelectedItem.Value + "  +日期+ "  + txtMessage.Text + " ;
            objsqlcommand =  SqlCommand(strquery,objsqlconnection);
            尝试
            {
                objsqlcommand.ExecuteNonQuery();
                txtMessage.Text = " ;
            }
            捕获
            {
                Console.WriteLine(" );

            } 


谢谢.

解决方案

完整的错误消息是什么?

Ujwala Gholap写道:

"/"应用程序运行时错误中的服务器错误

这是常见的错误标题,请参见下一节您的问题中出现行错误消息.

查看本文.
显示自定义错误页面 [function show(URL) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("display").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET",URL,true); xmlhttp.send(); }


Messages

code in the Message.aspx page

DateTime date=System.DateTime.Now;
            string strquery = "insert into tblMessage(StudId,EmailId,Date,Message) values('" + StudId + "','" + ddlReceiver.SelectedItem.Value + "','" + date + "','" + txtMessage.Text + "')";
            objsqlcommand = new SqlCommand(strquery, objsqlconnection);
            try
            {
                objsqlcommand.ExecuteNonQuery();
                txtMessage.Text = "";
            }
            catch
            {
                Console.WriteLine("Fail!!!!!!!!");

            }


Thank You.

解决方案

What''s the complete error message?

Ujwala Gholap wrote:

Server Error in ''/ '' Application Runtime error

That''s common error title, mention the next line error message in your question.

Check this article.
Displaying a Custom Error Page[^]


can you show the code that calls the javascript function show(url).


这篇关于服务器错误'/'应用程序运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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