简体   繁体   中英

Getting the url of the current request

I have a page for registering students and an email activation link is sent after submitting records. I have included the link for activation but it gets the whole url and includes it in the email. Can someone show how to solve the issue as currently it sends the whole page url in the email? Here is a sample of what is send to email:

localhost:89192/Staff/Register.aspx?rwndrnd=0.6363636646446373333CompleteRegistration.aspx?id=8901b88k1-81fa-8u10-m96e-892f6aea6710

Below is how am getting the current url

activationUrl = HttpContext.Current.Request.Url.Host+""+"://CompleteAccount.aspx?id=" + id.ToString();

Simply use

activationUrl = Request.Url.AbsoluteUri

Also, Request.Url.ToString() returns the full url (including querystring)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM