locked
The remote server returned an error: (500) Internal Server Error. how to solve this problem RRS feed

  • Question

  • User892410294 posted

    i used this coding in asp.net web application. may be the requestinng arguement(userid and password) is not correct format. i think this blow coding for consol application. how to send those arguement in asp.net web application ? or what is the problem?

    public void functionname()
    {

    HttpWebRequest myRequest = (HttpWebRequest)HttpWebRequest.Create("http://xxxxx/function.asmx/login");

    myRequest.Method = "POST";

    using (StreamWriter requestWriter = new StreamWriter(myRequest.GetRequestStream()))
    {

    requestWriter.Write("&{0}={1}", HttpUtility.UrlEncode("UserId"), HttpUtility.UrlEncode("christ"));

    requestWriter.Write("&{0}={1}", HttpUtility.UrlEncode("Password"), HttpUtility.UrlEncode("christ123"));


    }

    using (StreamReader responseReader = new StreamReader(myRequest.GetResponse().GetResponseStream())) // here throws internal error. it is not going inside this function.
    {

    result = responseReader.ReadToEnd();

    }

    }

    I am getting error like below:

    The remote server returned an error: (500) Internal Server Error.

    how to solve this error.

    Note : i tested normal method helloworld (which does not send arguement or sending any rerquest), that one does not face internal error. but if i send any arguement only(userid,password), it throws like " The Remote server returned an error:(500)Internal Server Error.

    help needed.

    Wednesday, February 12, 2014 10:41 AM

Answers