14

I know stackoverflow uses OpenID authentication. I want to try and use this as well. I am using asp.net mvc 2.0 with C#.

I found this

http://www.dotnetopenauth.net/

and I am wondering if this is what was used for stackoverflow.

Also any tutorials would be nice as well.

Edit

I am trying to load up some sample projects but when I build it in VS2010 I get

Error   6   'System.Diagnostics.Contracts.ContractInvariantMethodAttribute' is inaccessible due to its protection level C:\Users\chobo2\Downloads\DotNetOpenAuth-3.4.6.10357\DotNetOpenAuth-3.4.6.10357\Samples\OpenIdOfflineProvider\TextBoxTextWriter.cs  73  4   OpenIdOfflineProvider
Error   7   The type or namespace name 'ContractInvariantMethod' could not be found (are you missing a using directive or an assembly reference?)   C:\Users\chobo2\Downloads\DotNetOpenAuth-3.4.6.10357\DotNetOpenAuth-3.4.6.10357\Samples\OpenIdOfflineProvider\TextBoxTextWriter.cs  73  4   OpenIdOfflineProvider
Andrew Arnott
  • 80,040
  • 26
  • 132
  • 171
chobo2
  • 83,322
  • 195
  • 530
  • 832

4 Answers4

11

I have just found this tutorial which is useful.

Edit: This one also looks worth a read.

And I also found this example useful.

DevDave
  • 6,700
  • 12
  • 65
  • 99
11

Yes, it is the library SO uses. See this blog post from Jeff:

we have an excellent dialog with Andrew Arnott, the primary author of the open source DotNetOpenAuth library we use.

The download includes samples.

Community
  • 1
  • 1
Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • 1
    It's also *so* very easy to use! – Iain Galloway Jan 12 '11 at 16:49
  • @chobo2 - Have you added a reference to the assembly mentioned? You need to have code contracts installed. – Oded Jan 12 '11 at 19:49
  • System.Diagnostics seems to be part of the system .dll – chobo2 Jan 12 '11 at 19:57
  • @chobo2 - You are right. Perhaps they are expecting a different version :( – Oded Jan 12 '11 at 20:00
  • Not sure what version though. system.dll is like version 2.0 – chobo2 Jan 12 '11 at 21:58
  • Hmmm... I probably shouldn't have made that sample take a dependency on Code Contracts. However, if you're interested in making a web site that uses OpenID, you can ignore that sample (Unload it in VS2010 to stop the build errors) and look at the web-based RP samples. – Andrew Arnott Jan 14 '11 at 03:38
  • @chobo2 - See the comment from @Andrew Arnott, above - one sample depends on code contracts, but if you unload that project, you should be able to build the other samples without a problem. – Oded Jan 14 '11 at 08:12
  • @Andrew Arnott - Which project has the code contracts? Also what is the web-based Rp samples? – chobo2 Jan 27 '11 at 23:20
  • The build error should tell you which project it is for sure, but I think it's the OpenIDOfflineProvider project. The web-based RP samples are OpenIdRelyingPartyWebForms and OpenIdRelyingPartyMvc. – Andrew Arnott Jan 28 '11 at 05:14
8

Far too many things to comment, as suggested by Alex Angas. Best to just install the dependency, it's not included by default with .NET.

Code Contracts: http://research.microsoft.com/en-us/projects/contracts/

Nicholi
  • 1,083
  • 19
  • 33
  • 1
    This link above was not working for me, so I found the correct link here: http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx – Brian Mar 07 '12 at 21:46
  • 1
    Thanks for the update, now linking directly to their research page instead. Which has the proper download link to your page. – Nicholi Mar 07 '12 at 22:24
1

DotNetOpenAuth is a trustworthy choice.

To fix the build errors, comment out all references to Contract(...) in the code. They're only there to help the developers ensure code correctness and don't provide any functionality.

Alex Angas
  • 59,219
  • 41
  • 137
  • 210