CommonHelper.GetStoreAdminLocation() path is static in source code

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
I've renamed the /Administration/ folder for security reasons but noticed that whenever I clicked on Logout from within the Administration area the application was routed back to /Administration/Login.aspx which threw a 404 error. After some digging I found that the CommonHelper.GetStoreAdminLocation(bool useSsl) has the "/Administration" hard coded.

I suggest changing this by adding a web.config variable (possibly into the appSettings) that determines the path to the administration folder. This way one can set the Administration folder to whatever path or name without having to manually changing the source code in the CommonHelper.


/// <summary>
        /// Gets store admin location
        /// </summary>
        /// <param name="useSsl">Use SSL</param>
        /// <returns>Store admin location</returns>
        public static string GetStoreAdminLocation(bool useSsl)
        {
            string result = GetStoreLocation(useSsl);
            result += "Administration/";

            return result.ToLowerInvariant();
        }
13 years ago
Changed the source code in order to accommodate this scenario. The custom source for the CommonHelper is available  here

The source was changed to:

        /// <summary>
        /// Gets store admin location
        /// </summary>
        /// <param name="useSsl">Use SSL</param>
        /// <returns>Store admin location</returns>
        public static string GetStoreAdminLocation(bool useSsl)
        {
            string result = GetStoreLocation(useSsl);
            result += ConfigurationManager.AppSettings["administrationPath"].ToString();

            return result.ToLowerInvariant();
        }


Also, in the /Administration/web.config it's necessary to add the following appSetting (right after the <configuration> tag):

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="administrationPath" value="Administration/"/>
  </appSettings>
...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.