Trying to make the simplest OpenID using DotNetOpenAuth login to asp.net

I downloaded the Visual Studio 2010 template associated with http://www.dotnetopenauth.net/ . I can make it work as advertised. I do not start the project from scratch, and I do not want to invest a lot of time in integrating all web.config, handlers, etc. In my application to get OpenID to work for me. The document says that I should be able to make a single line implementation using a button and a user control. I believe I did this and I get an error.

Here is what I did.

  • Create an empty asp.net web project
  • Add DotNetOpenAuth.dll to bin and reference it
  • Add user registration to the top of the page
  • Create a button on the page that invokes user control.

When I run it and press the button, I get:

"Condition not met: this.Identifier! = Null Identifier not set.

I know that it should be more than that, but I just don’t understand. Can someone explain further what I need to do?

Thank,

<%@ Page Language="C#" %>
<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty" TagPrefix="rp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void LoginId_Click(object sender, EventArgs e)
    {
        OpenIdTextBox1.LogOn();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:Button ID="LoginId" runat="server" Text="Button" onclick="LoginId_Click" />

      <rp:OpenIdTextBox ID="OpenIdTextBox1" runat="server" />

    </div>
    </form>
</body>
</html>
+3
source share
1 answer

Do you actually enter the identifier in the field before clicking the button? You should.

And you can avoid an unpleasant mistake for people who forgot to enter an identifier by adding a control RequiredFieldValidatorthat points to a text field, and then checks that if (Page.IsValid)your handler has a button click before the call LogOn.

, . OpenIdLogin? , , - .

, ValidateRequest="false" <%@ Page %> . , ASP.NET OpenID, . , .aspx :

<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="login.aspx.cs" Inherits="OpenIdRelyingPartyWebForms.login" %>

<%@ Page ValidateRequest="false" Language="C#" AutoEventWireup="True" CodeBehind="login.aspx.cs" Inherits="OpenIdRelyingPartyWebForms.login" %>
+1

Source: https://habr.com/ru/post/1760662/


All Articles