难道说你有你的Bin目录和Web服务器的MVC的多个版本?这让我觉得,如果你有MVC的类型,如ActionResult
加载到你的AppDomain中的多个组件(不同的版本),以及AsActionResult
方法返回一个版本和你的MVC的Web应用程序使用不同的版本,它可能只是挽救了ToString
。你运行的是什么版本的ASP.NET MVC? DotNetOpenAuth的AsActionResult
方法是针对MVC框架的1.0 RTM版本编译的。如果您使用的是ASP.NET MVC 2(包含在.NET 4.0中),我可以看到这可能是一个问题。
我相信,如果你这个片段添加到您的MVC 2的web.config文件,它可以让你使用DotNetOpenAuth的正式建立,所以你不必建立自己的:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
什么是你的函数的返回类型? – 2009-12-21 22:57:14
ActionResult ...请参阅url中的示例...该函数是[AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get),ValidateInput(false)] public ActionResult OpenIdLogOn(string returnUrl){...} – promontis 2009-12-21 23:03:39
IMO链接中提供的代码示例没有任何问题,DotNetOpenAuth库也没有错。我已经多次检查了代码,并且没有太多可能会出错的代码。我认为*错误*是在路由或web.config中的某个地方...问题在哪里。 – promontis 2009-12-21 23:26:54