ASP.NET页面仅POST访问

I was wondering if it is possible to restrict access to an ASPX page to http POST request method only? This restricted page will be used to render some complex content. I want to use it for ajax calls which will return that content into a div on another page. Is it possible to disable GET requests so that users won't be able to access it via URL in their browser by accident?

You can't prevent user from making a GET request. You can choose on server that you won't serve those. For example like:

  if (!string.Equals(Request.HttpMethod, "POST"))
  {
      Response.StatusCode = 405;
      Response.End();
  }

This can be implemented in Page_Load event or even in HttpModule (if you need it for more pages, etc).