开发者

ASP.NET development server doesn't accept dot in pathinfo

开发者 https://www.devze.com 2023-01-29 07:18 出处:网络
I\'m trying out the facebook c# SDK (v4.0.2) and am experiencing a 404 error when facebook tries to redirect back to the redirect handler for the SDK.The resulting URL is:

I'm trying out the facebook c# SDK (v4.0.2) and am experiencing a 404 error when facebook tries to redirect back to the redirect handler for the SDK. The resulting URL is:

http://localhost:9152/facebookredirect.axd/elserdemo/Default.aspx?session={%22session_key%22%3A%222.GJsQK_BkApJNH8TncuFHpQ__.3600.1291665600-678938033%22%2C%22uid%22%3A%22678938033%22%2C%22expires%22%3A1291665600%2C%22secret%22%3A%22dnmnVip8JJ31rHUs2byKeQ__%22%2C%22base_domain%22%3A%22localhost%22%2C%22access_token%22%3A%22133477943366316|2.GJsQK_BkApJNH8TncuFHpQ__.3600.1291665600-678938033|xtjv95K4Lj_wg2-X3comNL4haG0%22%2C%22sig%22%3A%2241b1c3884488a9c9fa82b398c7fa80dc%22}

I have the facebook app set to iframe mode for the canvas and the necessary migrations settings in place. I've also made sure the canvas URL points to my local development server. However, when the browser tries to load the URL above, I get a 404 from ASP.NET.

If the pathinfo doesn't contain a period, it works and redirects to my app, so it appears it's the period in "default.aspx" that's screwing things up, but I'm not sure why. Any thoughts? Workarounds?

EDIT:

Although this is an issue with me with the facebook SDK, it's not specific to that. It's apparently an ASP.NET dev server issue. For example, if I try to load:

http://localhost:9152/facebookredirect.axd/elserdemo/default.aspx

I get a 404. However, if I try to load:

http://localhost:9152/facebookredirect.axd/elserdemo/default

It works, but then I end up at a facebook screen with a 404 in the iframe (because default is not a valid in my app).

EDIT #2:

This is not an issue with invalid chars in the URL. If it were, I would be receiving a开发者_如何学编程 400 error code (bad request). Instead, I am receiving 404, which tells me that the dev server is trying to load a file that doesn't exist, rather than stopping at the .axd and passing off the rest as Request.PathInfo like it should. I'm not sure WHY it's doing that, so that's really what I'm looking for here.


Your app is not redirecting to the correct adress. You are getting a serialized version of a FacebookSession object instead of a querystring with a signed_request.

Make sure you are setting the correct values on the facebook app configuration page.


You have to add the redirect handler to your web.config in order for the redirect to work, just add this lines to your web.config

  <system.webServer>
  <handlers>
      <add name="facebookredirect.axd" verb="*" path="facebookredirect.axd"
           type="Facebook.Web.FacebookAppRedirectHttpHandler, Facebook.Web" />
  </handlers>


Hitting reset on the previous answers.

What, exactly, is telling the browser to go to this URL: http://localhost:9152/facebookredirect.axd/elserdemo/default.aspx

I ask because Facebook should be configured to just go to http://localhost:9152/ and you indicated in the question that this happens when facebook redirects back to your site. The name of the handler shouldn't be in the URL at all which leads me to believe you've misconfigured the app within facebook itself.

Web handlers (like axd's) are executed for every incoming request automatically. If it detects that it needs to do something based on the request stream, then it will.


I got this same error - it turns out that its related to the mimetype mapped by the url's "extension." In your case, the ASP.NET development server is looking for the mimetype ".12916656....", or rather the last period to the end of the url.

If you switch to IIS on your local machine, you can set the default mimetype to application/octet-stream using the wildcard character (details at the link below). However, there's no way to do this in ASP.Net Development server:

http://support.microsoft.com/kb/326965

The 404 error and "File Not Found" exception appears to be how the server handles undefined mimetypes... quite confusing.

0

精彩评论

暂无评论...
验证码 换一张
取 消