- Download the DotNetOpenId library.
- Extract the DotNetOpenId.dll from the bin directory of the .zip file you downloaded.
- Make sure you're using FormsAuthentication.
- Open Web.config
- Find your
tag (or create it if you're sure it doesn't already exist) and change it if necessary so it looks something like this: (the really important part is just mode="Forms") <authentication mode="Forms"> <forms defaultUrl="/default.aspx" loginUrl="~/login.aspx"/> authentication>
- Add a Reference to DotNetOpenId.dll from your web site.
- Navigate to your Login.aspx page.
- Drag the OpenIdLogin control from your control Toolbox to the location on your page you want it to appear. NOTE: If the controls do not appear in your Toolbox, follow these steps to add them:
- Right-click somewhere on the Toolbox and click Choose Items... (it can take a while before the dialog shows up)
- In the .NET Framework Components tab, choose Browse.
- Select the DotNetOpenId.dll that you extracted from the zip file.
- Click OK.
- Several controls will get added to your Toolbox. Drag the OpenIdLogin control to your page.
- You should have a couple of new lines in your .aspx file:
<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.RelyingParty" TagPrefix="RP" %>
<RP:OpenIdLogin ID="OpenIdLogin1" runat="server" />
- If you're starting a brand new site and don't have a way to tell who is logged in on your site yet, go ahead and drag LoginName and LoginStatus controls to some new page that you can use to check your own logged-in status.
- Go ahead and run your app. You're already done.
Tuesday, November 23, 2010
How to add OpenID to your ASP.NET web site (in C# or VB.NET)
Adding OpenID support to your VB.NET web site couldn't be easier. Here is the easiest way:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment