Windows Azure POST Access Data

Good, so I can't find decent examples of Windows Azure. I have a simple welcome application based on this tutorial . I want to have custom output instead of JSON or XML. So I created my interface, for example:

[ServiceContract]
public interface IService
{
    [OperationContract]
    [WebInvoke(UriTemplate = "session/create", Method = "POST")]
    string createSession();
}

public class MyService : IService
{
    public string createSession()
    {
        // get access to POST data here: user, pass
        string sessionid = Session.Create(user, pass);
        return "sessionid=" + sessionid;
    }
}

In my life, I cannot figure out how to access data POST. Please help. Thank!

+3
source share
1 answer

HttpContext, Request, . ASP.Net , , , , , -.


EDIT: HttpRequest - , Form, , POST, HTTP-, System.Web, , , .


, Request.Form:

int loop1;
NameValueCollection coll;

//Load Form variables into NameValueCollection variable.
coll=Request.Form;
// Get names of all forms into a string array.
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++) 
{
    Response.Write("Form: " + arr1[loop1] + "<br>");
}

, HttpRequest.


WCF Simplified 4: / , "createSession" , . ASP.Net, , Request, Response, Server, Application Session.


, , , , , .

+1

Source: https://habr.com/ru/post/1782394/


All Articles