web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Getting environment UR...
Finance forum

Getting environment URL in d365

(0) ShareShare
ReportReport
Posted on by

Using this
System.Uri host = SessionContext::Get_Current().Get_RequestUrl();


I get the full url such as enviromentname.com/?mi=SysClassRunner&prt=initial&debug=vs&cls=myclass&activityid=0eb3ea5c-bb0b-0002-bf0a-b40e0bbbd401&cmp=mycompany


Is there any way i can just get "enviromentname.com"

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    240,275 Most Valuable Professional on at

    You can simply extract the domain name from the full URL.

    But you can also do something like this:

    var env = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();
    str domainName = env.Infrastructure.FullyQualifiedDomainName;


  • Mav Profile Picture
    on at

    Thanks for quick reply, it works.

  • Ammar Salah Profile Picture
    150 on at

    Adding to Martin's, for full URL like https://usnconeboxax1aos.cloud.onebox.dynamics.com/ 
    Use env.Infrastructure.HostUrl

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans