dotnetnukedotnetnuke-9

How can I get the Current URL Protocol in DNN?


How can I get Https or Http in the backend code of a DNN module?

Currently, I have got this code, but I need the protocol (https:// or http://)

PortalSettings.Current.PortalAlias.HTTPAlias + PortalSettings.HomeDirectory + PortalSettings.LogoFile;

Solution

  • You can maybe use this to check if the current tab has https enabled (to check the request itself you can use Request.IsSecureConnection)

    PortalSettings.ActiveTab.IsSecure
    

    And/or

    PortalSettings.SSLEnabled;
    PortalSettings.SSLEnforced;
    PortalSettings.SSLURL;