Converting the ASP.NET MVC project into OpenID

When you create an ASP.NET MVC project it comes with a controller called AccountController that manages logging in, logging out, registering, changing password and so on. Since usernames and passwords are dead I converted it into OpenID and I’m just pasting it here for everybody to use.

I’m using the DotNetOpenAuth library which you have to download, put in your project and refer. The difference between what I’m pasting and the example provided by DotNetOpenAuth is that I’m actually storing the user in the membership database, like the original AccountController.

My work is based on the on the blog post Adding OpenID to your web site in conjunction with ASP.NET Membership. I really had to put a couple of hours on top of that, so I consider it worth it to post it. Scott Hanselman also provides useful information for integrating OpenID. I’m using the jQuery OpenID plug-in but I’m not going to post my views. They are really trivial and left as an exercise to the reader.

I’m not using any extra tables, I’m storing the OpenID identifier (the URI) in the field for the username. This has the advantage of not requiring any other fields but the disadvantage that you can have only one identifier per user. There are some unfinished parts but since you are likely to customize them anyway, I don’t feel too guilty about not finishing yet. If you find a bug, please, let me know.

Continue reading “Converting the ASP.NET MVC project into OpenID”

Advertisements

Comment on Windows Weekly 116: Microsoft hasn't always been doing that

TWiT Windows WeeklyOn Windows Weekly 116Paul Thurrott talked about Microsoft Office 2010 for the web and the plan to make it run on Internet Explorer, Firefox, Chrome, Safari, etc. which is a great strategy for Microsoft and he said that Microsoft always did that: putting business first, with no agenda. I think that’s not true: Look at Microsoft Passport.

If I understand correctly, Microsoft Passport only worked on Internet Explorer (or worked very bad on other browsers). They had the agenda of pushing Internet Explorer and Microsoft Passport failed (thank god! OpenID is much better!). And I think that’s big news. Microsoft seems to be changing: ASP.NET MVC is released as open source among other things, they contribute free software to the Linux kernel, and now Office Web.

They even dared do something I would’ve never expected them to do: sell Office Web Server. I think that’s the way to go. Businesses want control, businesses want to have the information safely secured in their own basement, not on the cloud, not on every employee’s laptops, on the basement, and they want the easiness of only one machine with the software, constantly patched, upgraded and secure, and everybody just firing up a web browser.

Of course they are doing it because it’s in their own interest, as Google made Chrome because it’s in their own interest. Microsoft is a business, not a charity, it’s driven by their own interest (like any other company). I think the point is that Microsoft dropping their agenda makes them much more dangerous, maybe they’ll manage not to turn into the next IBM. For me it’s very hard not to have an agenda, I have to learn to do that.

Oh, another thing on Windows Weekly 116. I like the world Paul describes. Very Star Trekish in the sense that we won’t be carrying around laptops or netbooks, we’ll just use any terminal. I’ve been thinking about the pictures problem: what do you do with your digital camera. Paul’s solution is simple and although not practical today, it will mostly like be practical: the camera will have wifi or cellular network and will upload everything automatically to Picasa web or that f-site (they denied my username, I’m not mentioning them, I still have an agenda).

Currently it’s too much data, but I believe it is very likely we’ll reach a point where quality is good enough for us and network speeds will continue to increase. I think that happened with movies. Both network speed and video quality (and size) increase over time, but today it’s much more plausible to download a movie than 10 years ago. We already surpassed the tipping point for music.

The future looks bright!

Reviewed by Daniel Magliola. Thank you!

I will stop using web sites that don't support OpenID

With so many OpenID providers like MyOpenID, Google, Yahoo, AOL and more, with so many OpenID consumers, and so much software like WordPress, Plone supporting OpenID out of the box or with an easily installable plug in and with so many libraries like DotNetOpenID, JOpenID, Google App Engine Django OpenID, etc. I think we are ready to use OpenID everywhere.

I want to give my little push to the revolution, so here we go:

Reviewed by Daniel Magliola. Thank you!

Increasing views without changing content

Wordpress, image taken from: http://www.mangoorange.com/2008/09/16/7-requirements-when-designing-wordpress-theme/Six days ago I’ve switched from Plone to WordPress, again. I want to take my blog and web site into a new direction so I wrote a bunch of  drafts. But something unexpected happened. It already got a new life and I only published one new post (which wasn’t very popular either).

Analytics says that in the last 7 days I was already 31% better than the previous 7 days. And I’ve been running WordPress for less than 6 days. Furthermore, I’ve had rather large downtimes, about 24hs, as I moved things around, installed plug ins and wrestled with Apache. So, all in all, the improvement was rather large.

My  hyphothesis is that WordPress presents the information in a much better way, both for humans and computers. For computers I mean that it’s more easily indexed, it pings other aggregators and who knows what else. You could say it’s very SEOed.

For people it’s easier to use and more familiar. People are used to looking at blogs that look like that. I  don’t think this is to say that WordPress is better than Plone, I still believe that Plone is the best CMS out there, but the skins and design and the way the information is presented in list and topics should be improved to be more like WordPress and/or Mediawiki.

The really important lesson is that when you are making your own web site, maybe your own product with your own functionality, the presentation should be something familiar to the users. A good example would be Hunch, which you could say it’s a carbon copy of FlickrExcept that it doesn’t have anything to do with pictures or images! They made an interface that looks familiar for most users, so they can learn what Hunch does without being scared right away.

Reviewed by Daniel Magliola. Thank you!

Comment on TWiT 204: Taste Like Dirt. Lending Kindle books

On This Week in Tech 2004: Taste Like Dirt, Dwight Silverman proposed an interesting idea: to be able to lend books in the Kindle. The book would become unavailable on your Kindle and available on the other person’s Kindle, and after two weeks the book comes back automatically. I don’t think that feature would ever be implemented because it’s not on the publicist best interest.

It would be very simple to have a web app of people lending each other books across the world in a very organized and systematic way. The reason is that there’s no danger for the lender, the book will come back automatically. It’s not the same as lending a real dead tree paper book.

The solution is simple: don’t make it automatic for books to come back. Have the borrower have to press a button to return it. And if the borrower never does then you lose the book. Then you would only lend them to people you trust (not in a p2p-network way) or when you don’t care about losing the book.

What about book swapping? I don’t see a way to implement book swapping without allowing a systematic peer to peer network to exist. That leads me to the issue of DRM, which I’m not going to talk about now.

Reviewed by Daniel Magliola. Thank you!

If I were in charge of Skype

SkypeThis is what I would do if I were in charge of Skype, a product that could be doing much better. The big problem is, of course, adoption. Currently there are a lot of show stoppers:

  • You have to go to the site.
  • You have to download the software.
  • You have to install it.
  • You have to create an account.
  • You have to find and add your friend.
  • You have to remember to re-run it after you restart the computer.

If every obstacle halves the amount of users you are getting, Skype’s market could be 64 times bigger. That’s a lot.

I would start by writing a Flash implementation of Skype: Skype-on-the-web. Then going to skype.com/call/bob would call the Skype user bob without having to install anything or even create an account. With this feature Bob could tell his friend Sally, in an email or chatting with a competing product: “Go to skype.com/call/bob, let’s talk”. Personally, I would prefer Silverlight, but someone at Microsoft decided to halve its market by not supporting the microphone.

That’s open to abuse because anyone can call Bob at any time, anonymously. What a nightmare! That can be solved by requiring some random password, or hash. Bob would have a button on his Skype client that says “Generate call-me address” that would generate a use-once URL like skype.com/call/bob/dckx that would even work only for a short amount of time.

That last solution got a little bit too complicated. I would offer it, but I would also offer something much more intelligent. When Bob wants to talk with Sally he would go and add her to his buddy list by email address. That would automatically create an Skype account for Sally with a randomly generated password. Sally would get an email saying “Hey! You now have a Skype account! You can download Skype or just go to skype.com/on-the-web and start using it”. The most likely outcome is that Sally won’t do any of those things and will just throw that email away. That’s all right because now comes the best part.

The next time Bob calls Sally, since Sally is a non-convert yet, she’ll get an email saying: “Bob wants to talk with you! Answer him on skype.com/call/bob/dckx”. When Sally goes there, she doesn’t get a call-only-bob Skype, she gets a full featured Skype-on-the-web, automatically calling Bob. She’ll be able to call other users but what’s most important, she’ll have Bob in her buddy list. And when John does the same as Bob to call her, Sally will have Bob and John in her buddy list. Skype’s value for Sally is growing! She now has two good reasons to start using Skype

To increase the network effect hugely, I’d make it so that Bob won’t be able to see that Sally is not a Skype user. He won’t search for Sally and give up because she doesn’t have an account. He’ll just add her and it’ll seem to him that Sally is a Skype user. Because eventually she will. This model is nothing new, it’s how Paypal became the number one (only?) player in its field.

With the upcoming feature of screen sharing over Skype, tech support could also improve

Another thing I would do is target the support market. I would allow companies, like Dell, Microsoft, Apple, etc, to open corporate accounts and get the ability to have a lot of users under the same name (like “Dell Support”, “Microsoft Office Support”, “Apple iPod Support”, etc). Skype would handle all the routing and distribution of calls to each user using the typical call-center algorithms. Currently you call a local number and Dell routes you over the internet to where the call center is: India. That routing over the Internet is most likely paid by Dell. If their customers used Skype they’d be calling India directly lowering the bandwidth bill for Dell.

For the users it’s a huge win because sometimes it’s a hassle to find the right local number to call. And if you don’t speak the language of the country you’re in, or are traveling, it’s always a problem. Serving a global market globally is the way to go. After all, Skype knows which language you want to speak most of the time.

But the real jewel of this idea is this. Skype could try to discover the type of machine it is installed on and what products are installed alongside. You download Skype for MacOSX? Here’s Apple Support on your buddy list automatically. Microsoft Office installed? Either Mac or PC, here’s Microsoft Office Support on your buddy list. Running Skype on a Dell laptop? Here’s Dell support on your buddy list. The next step is letting any developer and company register a support line with Skype and enable it at install time of the application. For example: when you install Picasa, Google is added to your buddy list and, through a Skype API, Picasa has a “Call support” button that triggers Skype if locally installed or Skype-on-the-web otherwise.

Suddenly, Skype is becoming the dial tone of the internet (instead of that Twitter thingy).

Reviewed by Daniel Magliola. Thank you!