trend Posted July 16, 2005 Posted July 16, 2005 (edited) How do I send username/pw in asp.net for a website that requires basic authentication From a standards document specifying the Internet standards track protocol for the Internet community �HTTP Authentication: Basic and Digest Access Authentication� To receive authorization, the client sends the userid and password, separated by a single colon (":") character, within a base64 [7] encoded string in the credentials. basic-credentials = base64-user-pass base64-user-pass = <base64 [4] encoding of user-pass, except not limited to 76 char/line> user-pass = userid ":" password userid = *<TEXT excluding ":"> password = *TEXT Userids might be case sensitive. If the user agent wishes to send the userid "Aladdin" and password "open sesame", it would use the following header field: QWxhZGRpbjpvcGVuIHNlc2FtZQ== In our model, it would be passed as the following: https://www.website.com/login.aspx/Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== -------------------------------------------------- I am so lost.. I normally would just post the data.. but this seems different, any ideas? /edit/ Ok this is simply RFC 2617.. where a user will go to a website and they will get a windows popup asking for a username/pw. This setting can be setup in IIS.. but I need to know how to get asp.net to send a user to that website , and automatically enter in the username/pw and try to log the user in. Edited July 16, 2005 by trend Quote
trend Posted July 16, 2005 Author Posted July 16, 2005 Here is some guy doing this: http://www.eggheadcafe.com/articles/20030701.asp but I just cannot get it working... Anyone that helps me get this working, there is a cash prize :) Quote
trend Posted July 16, 2005 Author Posted July 16, 2005 (edited) I understand there are little refinements each user will have to do inorder to get this project going, but do you'll have such a tutorial? I modify web.config and compile the digestauthmodule.. I also turn off all authentication for IIS Also: change Dim query As String = "http://localhost/digestauthtestsvc/default.aspx" to Dim query As String = "http://localhost/DigestAuthModWeb2/default.aspx" in samplecredentials.aspx.vb and when I run the samplecredentials.aspx, I receive this error Server Error in '/DigestAuthModWeb2' Application. -------------------------------------------------------------------------------- The remote server returned an error: (401) Unauthorized. 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: (401) Unauthorized. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [WebException: The remote server returned an error: (401) Unauthorized.] System.Net.HttpWebRequest.CheckFinalStatus() System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) System.Net.HttpWebRequest.GetResponse() DigestAuthModWeb2.SampleCredentials.Page_Load(Object sender, EventArgs e) +92 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032 Have you'll seen anything like this before? Many thanks! Lee Edited July 17, 2005 by trend Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.