diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-26 21:21:04 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-26 21:21:04 -0700 |
commit | e25e3fbadf2a6c02946e8616d97f11c1aeb24abf (patch) | |
tree | 5b5268f68382d7683d9d7fbf392feb9b959b8899 /samples | |
parent | 58baddd63c1b9aecbded63490cbf784ce64ae651 (diff) | |
download | DotNetOpenAuth-e25e3fbadf2a6c02946e8616d97f11c1aeb24abf.zip DotNetOpenAuth-e25e3fbadf2a6c02946e8616d97f11c1aeb24abf.tar.gz DotNetOpenAuth-e25e3fbadf2a6c02946e8616d97f11c1aeb24abf.tar.bz2 |
Enhanced class asp sample to be a bit more resilient to error conditions.
Diffstat (limited to 'samples')
-rw-r--r-- | samples/OpenIdRelyingPartyClassicAsp/login.asp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/samples/OpenIdRelyingPartyClassicAsp/login.asp b/samples/OpenIdRelyingPartyClassicAsp/login.asp index 878ab39..d222e57 100644 --- a/samples/OpenIdRelyingPartyClassicAsp/login.asp +++ b/samples/OpenIdRelyingPartyClassicAsp/login.asp @@ -17,23 +17,37 @@ thisPageUrl = "http://" + Request.ServerVariables("HTTP_HOST") + Request.ServerVariables("URL") requestUrl = "http://" + Request.ServerVariables("HTTP_HOST") + Request.ServerVariables("HTTP_URL") Set dnoi = server.CreateObject("DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty") + On Error Resume Next Set authentication = dnoi.ProcessAuthentication(requestUrl, Request.Form) + If Err.number <> 0 Then + Response.Write "<p>" + Server.HTMLEncode(Err.Description) + "</p>" + End If + On Error Goto 0 if Not authentication Is Nothing then If authentication.Successful Then Session("ClaimedIdentifier") = authentication.ClaimedIdentifier - Session("Email") = authentication.ClaimsResponse.Email - Session("Nickname") = authentication.ClaimsResponse.Nickname - Session("FullName") = authentication.ClaimsResponse.FullName + If Not authentication.ClaimsResponse Is Nothing Then + Session("Email") = authentication.ClaimsResponse.Email + Session("Nickname") = authentication.ClaimsResponse.Nickname + Session("FullName") = authentication.ClaimsResponse.FullName + End If Response.Redirect "MembersOnly.asp" else Response.Write "Authentication failed: " + authentication.ExceptionMessage end if elseif Request.Form("openid_identifier") <> "" then dim redirectUrl + On Error Resume Next ' redirectUrl = dnoi.CreateRequest(Request.Form("openid_identifier"), realm, thisPageUrl) redirectUrl = dnoi.CreateRequestWithSimpleRegistration(Request.Form("openid_identifier"), realm, thisPageUrl, "nickname,email", "fullname") - Response.Redirect redirectUrl + If Err.number <> 0 Then + Response.Write "<p>" + Server.HTMLEncode(Err.Description) + "</p>" + Else + Response.Redirect redirectUrl + End If + On Error Goto 0 End If + %> <form action="login.asp" method="post"> OpenID Login: |