ping
ping

Reputation: 55

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();

Upvotes: 2

Views: 576

Answers (1)

Linga
Linga

Reputation: 10573

Simply use

activationUrl = Request.Url.AbsoluteUri

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

Upvotes: 4

Related Questions