c# - Sending an email with a link that will post the user to a particular page that i have got! -


basically, can send user emails. tried send him this:

mailmessage message = new mailmessage() {     subject = "yourguru account",     body = "thanks joining our site. click th link below validate 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 email "localhost"..but need appear real link..that press , redirects me. use visual studio 2010

it seems using

httpcontext.current.request.url.host

instead of httpcontext.current.request.url

for local dev environment getting localhost, when deploy web server, correctly update hosted web server url.

ideally, have path contain querystring , corresponding code in page load validate , use querystring.

example:

<br/>"+httpcontext.current.request.url.host + @"/accountvalidate.aspx?id=someid" 

note: use httpcontext.current.request.url , redirect current page querystring:

<br/>"+httpcontext.current.request.url + "?id=someid" 

and in page load of accountvalidate.aspx or current page:

string id = convert.tostring(request.querystring["id"]); if(!string.isnullorempty(id)) ... //code here inform user of successful activation 

the important point consider need way know user clicked on activation link, , hence query string of use.

hope helps!


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -