title: Get POST data in C#/ASP.NET
body: <p>I am trying to get POST data, but I'm having no luck. My code is below. When I click the form button nothing happens.</p>
  
  <p>I expected at least my IDE to snap at <code>A.Ret()</code>, but nothing happens whatsoever.</p>
  
  <h3>File Test.cs</h3>
  
  <pre><code>using System.Web;
  public class A
  {
      public static string ret() {
          var c = HttpContext.Current;
          var v = c.Request.QueryString; // &lt;-- I can see get data in this
          return c.Request.UserAgent.ToString();
          return c.Request.UserHostAddress.ToString();
          return "woot";
      }
  }
  </code></pre>
  
  <h3>File Default.aspx</h3>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="aspnetCSone._Default" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
      &lt;head runat="server"&gt;
          &lt;title&gt;Untitled Page&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;form id="form1" runat="server" method="post" action="Default.aspx"&gt;
              &lt;input type=hidden name="AP" value="99" /&gt;
              &lt;input type=button value="Submit" /&gt;
              &lt;div&gt;
                  &lt;a id="aa"&gt;a&lt;/a&gt;
                  &lt;% = A.ret() %&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>