在当前上下文中不存在名称clientresponse

时间:2013-05-23 09:26:10

标签: asp.net-mvc web-config httprequest dotnetopenauth

enter image description here

我在mvc3 razor代码中实现OpenID,(我在razor中使用nerddinner openid示例)我使用dotnetopenauth,我在authcontroller中得到了这个。 我使用Assembly DotNetOpenAuth.dll,v2.0.50727

这是我的web.config

<configSections>
    <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/>
  </configSections>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <!-- When targeting ASP.NET MVC 4, this assemblyBinding makes MVC 1 references relink
         to MVC 4 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it. -->
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

<pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="System.Globalization" />
        <add namespace="System.Linq" />
        <add namespace="System.Collections.Generic" />
      </namespaces>
    </pages>

1 个答案:

答案 0 :(得分:0)

我尝试手动将aspx转换为razor代码,这使我的代码运行干净

 var clientResponseInfo = (HttpRequestInfo)HttpRequestInfo.Create("GET", auth, headers: headers);
 response = RelyingParty.GetResponse(clientResponseInfo);