Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,
In my project am using a console application to do a back job function in that am not able to get the value from MVC controller and pass the value to console application.As am new to MVC am not able to know how to pass the values from controller to console application.please suggest some solutions which may help me to get a solution.
Posted
Comments
[no name] 10-May-14 5:11am    
both are different type of application. If you need to pass any parameter then you have to take the help of ServiceReference.

1 solution

C#
   class Program {

    static void Main(string[] args) {

        HttpClient client = new HttpClient();
        var content = new StringContent("=Here is my input string");
        content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
        client.PostAsync("http://localhost:2451/api/values", content)
            .ContinueWith(task => {

                var response = task.Result;
                Console.WriteLine(response.Content.ReadAsStringAsync().Result);
            });

        Console.ReadLine();
    }
}
 
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