title: ASP.NET MVC Redirect to same page after submit button is clicked
body: <p>some friends and I have started a team project but we are stuck at this point. We made a function of the site to add comments under every post. The problem is that when submit is clicked it adds the comment but doesn't refresh the page which causes some problems. The author stays "anonymous" and when refresh button is clicked it shows an alert:</p>
  
  <blockquote>
    <p>The page that you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you wish to continue?</p>
  </blockquote>
  
  <p>However, if we just type the URL again and click ENTER everything is good: the author shows up and the comment appears only once. So the only solution for us is to redirect to the same page. Here is the form: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div style="text-align: left"&gt;
    &lt;div&gt;&lt;i&gt;Leave your comment&lt;/i&gt;
    &lt;/div&gt;
    &lt;form method="post"&gt;
      &lt;fieldset&gt;
        &lt;p&gt;
          &lt;textarea rows="10" class="form-control" type="text" id="1" name="commentText" style="height: 100px"&gt;&lt;/textarea&gt;
        &lt;/p&gt;
  
        &lt;p&gt;
          &lt;input type="submit" name="buttonSubmit" onclick="redirect" value="Add comment" class="btn btn-default" style="" /&gt;
        &lt;/p&gt;
      &lt;/fieldset&gt;
    &lt;/form&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is how the comments are printed on the page:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;h3&gt;Comments&lt;/h3&gt; 
  &lt;br&gt;
  &lt;div&gt;
    @foreach (var comment in ViewBag.Comments) {
    &lt;section class="row"&gt;
      &lt;article class="post col-md-12"&gt;
        &lt;div class="about"&gt;
          Posted on &lt;i&gt;@comment.Date&lt;/i&gt;
          @if (comment.AuthorId != null) { @: by &lt;i&gt;@comment.Author.FullName&lt;/i&gt;
          }else { @: by &lt;i&gt;anonymous&lt;/i&gt;
          }
        &lt;/div&gt;
        &lt;div class="body"&gt;@comment.Text&lt;/div&gt;
      &lt;/article&gt;
    &lt;/section&gt;
    }
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks in advance!</p>