MVC use action attributes to map the same view for http get or post:
 [HttpGet] 
 public ActionResult Index()
 {
    ViewBag.Message = \"Message\";
    retur         
        For dot net core it is:
Context.Request.Method == "POST"
<% if (System.Web.HttpContext.Current.Request.HttpMethod.ToString() == "GET") { %><!-- This is GET --><% }
   else if (System.Web.HttpContext.Current.Request.HttpMethod.ToString() == "POST")
      { %><!--This is POST--><%}
      else
      { %><!--Something another --><% } %
System.Web.HttpContext.Current.Request.HttpMethod stores current method. Or just Request.HttpMethod inside of view, but if you need to check this, there may be something wrong with your approach.
Think about using Post-Redirect-Get pattern to form reposting.