mardi 22 septembre 2015

Issue returning HttpWebRequest instance to the client side

I need to pass data inside my HTTP URL body. I'm not really sure how to do this. After browsing for a while I found a way, which is to return HttpWebRequest instance to the client-side. But i need to return an URL with data(content,file name) attached to it(not HttpWebRequest):

[HttpPost]
public HttpWebRequest FileSend_Post()
{
    string content = "google";
    string fileName = "doc.txt";
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:59831/Home/FileSend_Post?fileName=" + fileName);
    request.Headers.Add("content", content);
    request.ContentType = "application/text";
    request.Proxy = null;
    request.ContentLength = 0;
    request.Method = "POST";

    return request;

}

can someone please help me with this.




Aucun commentaire:

Enregistrer un commentaire