Click here to Skip to main content
15,921,989 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
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
C#
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.
Posted
Updated 12-Nov-11 0:39am
v2

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[^]
 
Share this answer
 
can you show the code that calls the javascript function show(url).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900