@localhost Email Addresses

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 3 Followers

Not Ranked
36 Posts
Points 415
mattb posted on Mon, May 12 2008 11:38 AM

I had this issue when I installed CS v2007 - using forms authentication and the add-on that automatically creates accounts in CS based on an email address I store in a cookie.  To fix the issue, I explicitly set the cookie domain in code EVEN THOUGH it's set in the web.config file.  That seemed to work.

Now, after upgrading to 2008, I'm seeing many more trickling through that have the @localhost part tagged onto their email address.

Any thoughts on a solution? 

http://community.metalreview.com/forums

  • | Post Points: 20

Answered (Verified) Verified Answer

Top 10 Contributor
5,231 Posts
Points 48,145
CS Developers

What cookie domain setting are you referring to in the web.config?  Do you mean on the <forms /> line?  If so, that has to do with the Forms Authentication ticket, and is not associated with email addresses at all.  It is used to set the cookie domain for the browser.

With the Forms Authentication SSO module, you need to set the user's email address in the cookie information along with their log in.  Please see the formsauthtest.aspx sample implementation with the download to see how it is used.  Basically, you need to include an additional cookie along with the Forms Auth ticket which includes their email address.  If CS doesn't get this cookie, it will failover to username@localhost to keep from dying, as CS needs an email address in order to create the user.

  • | Post Points: 20

All Replies

Top 10 Contributor
5,231 Posts
Points 48,145
CS Developers

What cookie domain setting are you referring to in the web.config?  Do you mean on the <forms /> line?  If so, that has to do with the Forms Authentication ticket, and is not associated with email addresses at all.  It is used to set the cookie domain for the browser.

With the Forms Authentication SSO module, you need to set the user's email address in the cookie information along with their log in.  Please see the formsauthtest.aspx sample implementation with the download to see how it is used.  Basically, you need to include an additional cookie along with the Forms Auth ticket which includes their email address.  If CS doesn't get this cookie, it will failover to username@localhost to keep from dying, as CS needs an email address in order to create the user.

  • | Post Points: 20
Not Ranked
36 Posts
Points 415
mattb replied on Mon, May 12 2008 1:57 PM

After I validate credentials, I do this:

 

FormsAuthentication.SetAuthCookie(txtUsername.Text, chkRememberMe.Checked);

MembershipUser user = Membership.GetUser(txtUsername.Text);

string strEmailAddress = user.Email;

HttpCookie cookie = Request.Cookies["CSUserEmailAddress"];

if (cookie == null)

{

cookie = new HttpCookie("CSUserEmailAddress");

}

FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, txtUsername.Text, DateTime.Now, DateTime.Now.AddMonths(3), chkRememberMe.Checked, strEmailAddress);

cookie.Value = FormsAuthentication.Encrypt(ticket);

cookie.Expires = ticket.Expiration;

 cookie.Path = ticket.CookiePath;

cookie.Domain = ".metalreview.com";

 

http://community.metalreview.com/forums

  • | Post Points: 5
Page 1 of 1 (3 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com