Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8650843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:55:08+00:00 2026-06-12T13:55:08+00:00

I’ve got the following code running in a Windows Store application that is supposed

  • 0

I’ve got the following code running in a Windows Store application that is supposed to call one of my WebApis:

using (var client = new HttpClient())
{
    var parms = new Dictionary<string, string>
        {
            {"vinNumber", vinNumber}, 
            {"pictureType", pictureType}, 
            {"blobUri", blobUri}
        };

    HttpResponseMessage response;

    using (HttpContent content = new FormUrlEncodedContent(parms))
    {
        const string url = "http://URL/api/vinbloburis";

        response = await client.PostAsync(url, content);
    }

    return response.StatusCode.ToString();
}

The WebApi code looks like this:

[HttpPost]
public HttpResponseMessage Post(string vinNumber, string pictureType, string blobUri)
{
    var vinEntity = new VinEntity
        {
            PartitionKey = vinNumber,
            RowKey = pictureType, 
            BlobUri = blobUri
        };

    _vinRepository.InsertOrUpdate(vinEntity);

    return new HttpResponseMessage { Content = new StringContent("Success"), StatusCode = HttpStatusCode.OK };
}

Using Fiddler, I’ve observed the following … here’s what the request looks like:

POST http://URL/api/vinbloburis HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: URL
Content-Length: 113
Expect: 100-continue

vinNumber=vinNumber&pictureType=top&blobUri=https%3A%2F%2Fmystorage.blob.core.windows.net%2Fimages%2Fimage.png

But the response is an error with little/no information:

{"Message":"An error has occurred."}

I’ve even tried locally with the debugger attached to the WebApis and my Post method never catches.

Does anyone see something I’ve missed here? I feel like I’m looking right at it but not seeing it. I should add that I am able to call an HttpGet method while passing a parameter through the querystring. Right now the problem is only with this HttpPost.

Thanks!

UPDATE: Based on some good comments from folks I’m adding some more details.

I have the default routes configured for WebApis …

public static void Register(HttpConfiguration config)
{
    config.Routes.MapHttpRoute(
        name: "DefaultApi",
        routeTemplate: "api/{controller}/{id}",
        defaults: new { id = RouteParameter.Optional }
    );
}

Consequently, I think /URL/api/vinbloburis should work. Additionally, as alluded above, I currently have this working with an HttpGet. Here’s what’s working in the Windows Store app to call the HttpGet WebApi …

using (var client = new HttpClient())
{
    using (var response = await client.GetAsync(uri))
    {
        if (response.IsSuccessStatusCode)
        {
            var sasUrl = await response.Content.ReadAsStringAsync();
            sasUrl = sasUrl.Trim('"');

            return sasUrl;
        }
    }
}

… and it’s calling the following WebApi …

[HttpGet]
public HttpResponseMessage Get(string blobName)
{
    const string containerName = "images";
    const string containerPolicyName = "policyname";

    _helper.SetContainerPolicy(containerName, containerPolicyName);

    string sas = _helper.GenerateSharedAccessSignature(blobName, containerName, containerPolicyName);

    return new HttpResponseMessage
        {
            Content = new StringContent(sas),
            StatusCode = HttpStatusCode.OK
        };
}

I hope the additional information helps!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:55:09+00:00Added an answer on June 12, 2026 at 1:55 pm

    I copied your code, as is and I was getting a 404 error.

    I changed the signature to

    public HttpResponseMessage Post(FormDataCollection data)
    

    and it worked.

    You can also just do this,

    public HttpResponseMessage Post(VinEntity vinEntity)
    

    and the model binder will do the mapping work for you.

    Rick Strahl has a post on the issue here http://www.west-wind.com/weblog/posts/2012/Sep/11/Passing-multiple-simple-POST-Values-to-ASPNET-Web-API

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.