2

I'm trying to submit a simple form for my ASP.NET MVC website, but I keep getting a StackOverFlow Exception. I don't understand what I'm doing wrong; it should be a pretty straightforward process... Here is the form code:

<form action="/Home/SubmitAnnouncements" method="post">
    <textarea name="announcementcode" style="width:100%; height:800px">@Model.RawAnnouncementCode</textarea>
    <div id="find_account" class="two columns"><input id="find_account_btn" class="link_button" type="submit" name="Submit" value="Submit New Announcements" /></div>
</form>

And here is the Controller code for the action:

[HttpPost, ValidateInput(false)]
public ActionResult SubmitAnnouncements(string announcementcode)
{
    SubmitAnnouncements(announcementcode);
    return RedirectToAction("Index", "Home");
}

This problem stated when I added [HttpPst, ValidateInput(false)], but I need to do that, because the user is submitting raw HTML code. Any ideas anyone?

2
  • 7
    Your method is calling itself. Commented Apr 21, 2016 at 18:01
  • 4
    I'm an idiot, I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot,I'm an idiot... it's supposed to be DatabaseCalls.SubmitAnnouncements()... Thanks...I'm an idiot... Commented Apr 21, 2016 at 18:03

1 Answer 1

6

The ValidateInput attribute didn't cause your error, you just never reached the point in your code that causes the StackOverflowException until it was added.

If you look at the first line of your action, you'll notice you're calling the same method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.