【发布时间】:2012-01-26 11:05:38
【问题描述】:
我正在玩 DotNetOpenAuth 示例,试图了解如何与 OpenID 正确集成。其中一个示例称为 OpenIdRelyingPartyMvc。它有两个代码部分,我不确定它们如何影响功能。
-
在 Global.asax.cs 中:
routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = string.Empty }); // Parameter defaults routes.MapRoute( "Root", string.Empty, new { controller = "Home", action = "Index", id = string.Empty });
如果我删除映射“Route”的最后一行,似乎没有任何影响:映射“Default”似乎就足够了。为什么会有“Route”路线?
-
在 HomeController.cs 中
public class HomeController : Controller { public ActionResult Index() { Response.AppendHeader( "X-XRDS-Location", new Uri(Request.Url, Response.ApplyAppPathModifier("~/Home/xrds")).AbsoluteUri); return View("Index"); } public ActionResult Xrds() { return View("Xrds"); } }
如果我删除“AppendHeader”调用并测试示例,它仍然有效!我知道这个头文件就足够了,我只是不能让示例应用程序依赖它:它可以在没有设置的情况下工作。如果我在 Xrds 方法中设置断点,它永远不会被触发。
【问题讨论】:
标签: dotnetopenauth