how to get data in mvc using http post

say, I have controller method and a corresponding view (see below).

once I load the view, I have a self invoking JavaScript function, that calls the same controller method.
code below, shows the get request, when I test this, I get the value of 1 in the id parameter of my ProcessData method.
in Get request, the data is passed in the query string, which is mapped to my parameter name by ASP.NET ( I guess by the process of model binding). I understand this part.

My question is, if i wanted to do a post request and send a XML data over to the same controller method, how can I achieve this.

In a post request, how do we read data in the controller?

controller -
public ActionResult ProcessData(string id) {          
      return View();

view -

    ViewBag.Title = "test";


@section scripts {
    <script type="text/javascript">
        (function () {
                type: "Get",
                url: '@Url.Action( "ProcessData", "Test")',
                contentType: "application/xml; charset=utf-8",
                data: {id : 1},              
                success: successFunc,
                error: errorFunc
            function successFunc(data, status) {
            function errorFunc() {
mikha eAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is the xml in a file?
mikha eAuthor Commented:
@louisfr - it is a XML string.
You can pass it in the same way you pass "id".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

mikha eAuthor Commented:
@louisfr : I tried that and it did work, but not exactly how I expected. In the ajax call, i'm passing it as

 data: {xmldata : xmlString },     and in my controller method , I had to read the inputstream, because the string parameter xmldata was coming as "null".
any thoughts on this?

pubic void ReadRequest(string xmldata){
    var data = this.Request.InputStream;
It may have to do with the size of the data.
I'm going to do some tests to check that.
A ValueProviderFactory may be what you're looking for.
I found an example at
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.