Revision: 67404
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 18, 2014 11:35 by guru2015
Initial Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
using System.Web;
using System.Net;
namespace DisplayDataInformation
{
public partial class DisplayDataInformation : Form
{
public DisplayDataInformation()
{
InitializeComponent();
}
private void Submit(object sender, EventArgs e)
{
localhost.Dashboard proxy = new localhost.Dashboard();
localhost.MetaData[] pm = proxy.GetAllMetaData();
//const string MyProgramURL = "http://localhost/MyProgramm/";
const string apiKey = "MyKey123";
const string ProgramId = "user1";
const string ProgramPass = "123456";
HttpWebRequest myHttpWReq;
HttpWebResponse myHttpWResp;
// myHttpWReq.ContentType
// Make a web request to the web service
myHttpWReq = (HttpWebRequest)System.Net.WebRequest.Create("http://localhost/MyProgram/Dashboard.asmx/GetAllMetaData" + apiKey + ProgramId + ProgramPass);
myHttpWReq.Method = "Post";
//myHttpWReq.Method = "Get";
myHttpWReq.ContentLength = 0;
// Get the response of the web service
myHttpWResp = (HttpWebResponse)myHttpWReq.GetResponse();
if (myHttpWResp.StatusCode == HttpStatusCode.OK)
{
//Create an XML reader to parse the response
System.Xml.XmlReader reader = System.Xml.XmlReader.Create(myHttpWResp.GetResponseStream());
}
//set an string output to the windows form
StringBuilder sb = new StringBuilder();
foreach (localhost.ProjectMetaData value in pm)
{
sb.AppendLine(value.ProjectTitle + " - "
+ value.ProjectID + " - "
+ value.PublishStatus);
}
label1.Text = sb.ToString(); //some label on your form for output
}
}
}
Initial URL
none
Initial Description
I have completed my code my its giving me The remote server returned an error: (500) Internal Server Error. I been trying with Get and Post method but not luck, can anyone help me to view what I could doing wrong? Here you have my code, as you can see in comments I have tried several thing but nothing work This is an important project for me and I been looking everywhere and I have no luck. Thanks
Initial Title
web api client getting the Remote server returned an error:500
Initial Tags
api, c#
Initial Language
C#