本文介绍了服务器错误'/'应用程序运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我想在单击消息链接时重定向Message.aspx页.当我单击消息发送按钮时,我收到一个错误,例如"/"应用程序中的服务器错误.在我的应用程序中,我使用了Ajax代码.
请帮帮我.
功能展示(网址) { 如果(window.XMLHttpRequest) {// IE7 +,Firefox,Chrome,Opera,Safari的代码 xmlhttp = 新 XMLHttpRequest(); } 其他 {// IE6,IE5的代码 xmlhttp = 新 ActiveXObject(" Microsoft.XMLHTTP" ); } xmlhttp.onreadystatechange = function() { 如果(xmlhttp.readyState == 4 && xmlhttp.status == 200 ) { document.getElementById(" display" ).innerHTML = xmlhttp.responseText; } } xmlhttp.open(" GET" ,URL, true ); xmlhttp.send(); }
消息
Message.aspx页面中的代码
DateTime date = System.DateTime.Now; 字符串 strquery = " 插入tblMessage(StudId,EmailId,日期,消息)值('" + StudId + " ','" + ddlReceiver .SelectedItem.Value + " ','" +日期+ " ','" + txtMessage.Text + " ')" ; objsqlcommand = 新 SqlCommand(strquery,objsqlconnection); 尝试 { objsqlcommand.ExecuteNonQuery(); txtMessage.Text = " " ; } 捕获 { Console.WriteLine(" 失败!!!!!!" ); }
谢谢.
解决方案
这是常见的错误标题,请参见下一节您的问题中出现行错误消息.
查看本文.
显示自定义错误页面 [ ^ ]
In my application,I want to redirect Message.aspx page on click of message link.When I click on message send button I receive an error such as Server Error in ''/'' Application.In my application I used Ajax code for this.
Please Help me.
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.
解决方案
That''s common error title, mention the next line error message in your question.
Check this article.
Displaying a Custom Error Page[^]
这篇关于服务器错误'/'应用程序运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!