Before
implement twitter login authentication we need to get consumerKey and consumerSecret
key
from twitter for that we need to create application in twitter by using this
link https://dev.twitter.com/apps/new once open that will display window like this

Once app page opened enter Application Name, Description,
website (Ex: http://aspdotnet-suresh.com)
and callback url details and click create new application button and here one
more thing we need to remember is twitter won’t support for
localhost sites (ex: http://localhost/Default.aspx) because of that we need to
give hosted domain site url.

If you want to test this with your local application no
worries check this post how host website in IIS with custom URL .Once our app created in twitter that would
be like as shown below image here we can change logo of our application

Now create new application using visual
studio and write following code aspx page

If you observe above code I used oAuthTwitter class file you can get this class file from downloadable code.Now get consumerKey and consumerSecret key from twitter and add it in web.config file like this

hello sureshbhai.. I follow your article for login using facebook in website..now i want that get user login data like email ,paassword for storing in our database..and i also want how to get this data at server side means how to get username,password etc on server side to store it on our database

I seriouslу love уour blog.. Very nice сolors & thеme. Did you develοp thіѕ amazing site yoursеlf? Рlеase reply back as I'm looking to create my own personal website and want to learn where you got this from or what the theme is named. Thanks!

It does not work for me.I got the following Error,-----------------------------------------------Server Error in '/ThanthiTv' Application.The remote server returned an error: (404) Not Found.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (404) Not Found.

Following Code will work,XML ends on 2012.Here Use JSON-----------------------------------------------if (oAuth.TokenSecret.Length > 0) { //We now have the credentials, so make a call to the Twitter API.

Thanks, It was very helpful, I have a doubt, I have my App login so I offer the user to log in with Twitter or Facebook. After the user logs in, I compare user data with my App user data. But in order to do this, I need the user Email in order to compare both data. How can I do that if Twitter does not retrieve email? thanks

Thanks for sharing your twitter experience with us. It really works for me.Regarding getting Email ID, I followed https://dev.twitter.com/discussions/4019 link, the twitter employee clearly mention that "The API won't return an email address" which makes no sense. ;)

Hi ,nice blog but Response.Redirect(oAuth.AuthorizationLinkGet()); giving runtime error that url can not be null.and another problem is how to get _oauthVerifier value?because in my app on twitter I am not getting Please help meThanx..

thanks for this great article :) but unfortunately this code is not running now. After downloading the sample code and run the application I'm always get the message of "The remote server returned an error: (401) Unauthorized." so please any help would be appreciated

Thanks. This code helped me very much. Only one comment: I had an error: The remote server returned an error: (401) Unauthorized. Solution: 1.- Putting corretly the url callback.2.- Change of http to https: