I came across a requirement where i had to find the current domain address of the app as i had to send an email to users with a public page url. I knew the virtual address of page but it would not work as in order to open a page from my website using that email link, i had to provide the complete address of webpage. This is the solution i found for this issue.
string baseDomain = Request.RequestUri.Scheme + System.Uri.SchemeDelimiter + Request.RequestUri.Host + (Request.RequestUri.IsDefaultPort ? "" : ":" + Request.RequestUri.Port);
This gave me the URL of my base domain i.e. https://localhost:44300/
0 Comment(s)