Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC3 - ActionResult rendering DotNetOpenAuth WebResponse as String
    primarykey
    data
    text
    <p>I've just updated my MVC2 project to run MVC3 (RC). Everything is working as expected except for one problem.</p> <p>I'm running DotNetOpenAuth, but when I go to authenticate, my page renders the string</p> <blockquote> <p>DotNetOpenAuth.Messaging.OutgoingWebResponseActionResult</p> </blockquote> <p>instead of authenticating (which worked in the MVC2 app)</p> <p>I found this question <a href="https://stackoverflow.com/questions/1943147/actionresult-redirect-renders-using-tostring">elsewhere on SO</a>, and I did what was suggested, but to no avail.</p> <p>Here is a clip of my Web.Config</p> <pre><code>&lt;/configSections&gt; &lt;runtime&gt; &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt; &lt;dependentAssembly&gt; &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/&gt; &lt;bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0"/&gt; &lt;/dependentAssembly&gt; &lt;/assemblyBinding&gt; &lt;/runtime&gt; &lt;system.web.webPages.razor&gt; </code></pre> <p>What else could be causing this problem?</p> <p>If it helps, here's the Controller code that was working prior to MVC3</p> <pre><code> ''# &lt;ValidateInput(False)&gt; _ ''# this code is commented out so that it displays properly on StackOverflow - It's not really commented out in the project. Public Function Authenticate(ByVal go As String) As ActionResult Dim response As IAuthenticationResponse = openid.GetResponse() If response Is Nothing Then ''# Stage 2: user submitting Identifier Dim id As Identifier If Identifier.TryParse(Request.Form("openid_identifier"), id) Then Try Return openid.CreateRequest(Request.Form("openid_identifier")).RedirectingResponse.AsActionResult() Catch ex As ProtocolException ViewData("Message") = "Woops! " &amp; ex.Message Return View("Login") End Try Else ViewData("Message") = "Woops! Invalid identifier" Return View("Login") End If Else ''# Stage 3: OpenID Provider sending assertion response Select Case response.Status Case AuthenticationStatus.Authenticated If Not OpenIDService.IsOpenIdAssociated(response.ClaimedIdentifier) Then ''# All of this happens if the user logging in does ''# not currently have an account associated with ''# their OpenId. We probably want to handle this a ''# little differently by sending them to a view that ''# allows them to confirm account creation or try ''# again. ''# TODO: Create an Authenticate View and a CreateUser ActionResult (without a View) UserService.AddUser(response.ClaimedIdentifier, response.FriendlyIdentifierForDisplay) UserService.SubmitChanges() ActivityLogService.AddActivity(OpenIDService.GetOpenId(response.ClaimedIdentifier).UserID, _ ActivityLog.LogType.UserAdded, _ HttpContext.Request.UserHostAddress) Else ActivityLogService.AddActivity(OpenIDService.GetOpenId(response.ClaimedIdentifier).UserID, _ ActivityLog.LogType.UserLogin, _ HttpContext.Request.UserHostAddress) End If ''# Again, we want to make sure to associate the users ''# actions with an entry in the ActivityLog for further ''# use with Badges ActivityLogService.SubmitChanges() ''# Create the authentication cookie. This cookie ''# includes the AuthUserData information in the ''# userData field of the FormsAuthentication Cookie. Dim authUser As Authentication.AuthUserData = New Authentication.AuthUserData(OpenIDService.GetOpenId(response.ClaimedIdentifier).User) HttpContext.Response.Cookies.Add(Authentication.CustomAuthentication.CreateAuthCookie(response.ClaimedIdentifier, _ authUser, _ True)) authUser = Nothing If Not String.IsNullOrEmpty(go) Then : Return Redirect(go) Else : Return RedirectToAction("Index", "Events") End If Case AuthenticationStatus.Canceled ViewData("Message") = "Canceled at provider" Return View("Login") Case AuthenticationStatus.Failed ViewData("Message") = response.Exception.Message Return View("Login") End Select End If Return New EmptyResult() End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload