I am new to this community and I downloaded and installed the MVC4 along with the Web API template.
Then, I created a new solution with the Web Api template.
I created a new Controller and View, which is basically a html page which contains a form which creates a Post towards another Controller, which is basically a copy of the ValuesController, which is created when selecting the Web API Template of the MVC4
solution.
When I click the submit button a download window is shown and immediately an error is raised saying that the download failed. But I only wanted to create a post and possible feedback shown in the iframe named result, which is set as target attribute in the
form-Tag.
I tried to modify the Post Method with a return value of HttpResponseMessage and the sample with void, both show the exact behavior.
I don't know where the problem might be. Maybe someone had the same issue and resolved it? Or any suggestion?
JanGD
0 Points
14 Posts
Post Method results in unexpected download, which fails
May 04, 2012 08:14 AM|LINK
Hello all,
I am new to this community and I downloaded and installed the MVC4 along with the Web API template.
Then, I created a new solution with the Web Api template.
I created a new Controller and View, which is basically a html page which contains a form which creates a Post towards another Controller, which is basically a copy of the ValuesController, which is created when selecting the Web API Template of the MVC4 solution.
The code of the html looks like this:
@{ Layout = null; } <!DOCTYPE html> <html> <head> <!-- <meta name="viewport" content="width=device-width" /> --> <title>webProxy Tester</title> </head> <body> <form action="http://localhost/MyController/api/MyController" enctype="text/html" method="post" target="result"> POST data: <br /> <textarea name="person" cols="100" rows="20"></textarea> <input type="submit" value="Submit" /> <br /><br /> <a href="http://localhost/MyController/api/MyController" target="result">Get resource</a> <br /><br /> <iframe name="result" width="1000px" /> </form> </body> </html>When I click the submit button a download window is shown and immediately an error is raised saying that the download failed. But I only wanted to create a post and possible feedback shown in the iframe named result, which is set as target attribute in the form-Tag.
I tried to modify the Post Method with a return value of HttpResponseMessage and the sample with void, both show the exact behavior.
I don't know where the problem might be. Maybe someone had the same issue and resolved it? Or any suggestion?
Thanks in advance
~Jan