Facebook Canvas Post ASP.net

Facebook requires all canvas applications to support HTTP POST in an iframe instead of GET. However, when I enable this feature, ASP.net complains that

The HTTP verb POST used to access path '/' is not allowed

For some reason, Facebook requires a path in which there is no extension (for example, it requires mydomain.com/random/instead mydomain.com/mypage.aspx).

How to enable POST for aspx pages and root page (default) on my web.config page so that I can create the application locally? I find the configuration in IIS simpler.

Thank.

+3
source share
3 answers

I found a workable solution by “rewriting” requests to my root path in the Global.asax file. Works for the development server, but you may have to remove it for production:

void Application_BeginRequest(object sender, EventArgs e) {
  string p = Request.Path;
  if (p.Equals("/myapp/")) {
    var query = "?" + Request.QueryString.ToString();
    if (query.Equals("?")) {
      query = "";
    }
    Context.RewritePath("/myapp/Default.aspx" + query);
  }
}
0

. , . - VStudio, <add verb="*" path="/" type="System.Web.UI.Page"/> <httpHandlers>. , Page_Load. System.Web.UI.Page , Page_Load , .aspx, , . Response.Write() Page_Load .

, , , , , .

, , , .

: machine.config - System.Web.UI.PageHandlerFactory

+1

, ... , FB, .

0
source

All Articles