Basically, I can send the user emails. I tried to send him this:
MailMessage message = new MailMessage()
{
Subject = "YOURGURU account",
Body = "Thanks for joining our site. click th link below to validate your account"+
"<br/>"+
HttpContext.Current.Request.Url.Host
};
message.To.Add(new MailAddress("makovetskiyd@yahoo.co.uk", "Some name"));
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.EnableSsl = true;
client.Send(message);
Response.Redirect("CheckYourEmail.aspx");
The HttpContext.Current.Request.Url.Host function appears in the email as “localhost”..but I need it to appear like a real link..that I press and it redirects me. I use visual studio 2010
It seems that you are using
HttpContext.Current.Request.Url.Hostinstead of
HttpContext.Current.Request.UrlFor your local dev environment you will be getting
localhost, but when you deploy this to some web server, this would correctly update itself to the hosted web server url.Ideally, you would have some path that would contain the querystring and then corresponding code in page load to validate and use the querystring.
Example:
Note: You could use the HttpContext.Current.Request.Url also and that would redirect you to the current page with querystring:
And then in page load of AccountValidate.aspx or current page:
The important point to consider is that you would need some way to know which user clicked on the activation link, and hence the query string would be of use.
Hope it helps!