Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: AppConfig RedirectLiveToWWW

  1. #1
    jimmidude is offline Junior Member
    Join Date
    Nov 2009
    Posts
    11

    Default AppConfig RedirectLiveToWWW

    On version 8.0.12 does this setting redirect all non www reqests to a www.my domain request? The documentation seems to indicate in only acts on the default.aspx page. I had this set to true then asked my hosting company to set an IIS redirect and they set it caused a looping issue and they removed it. I set this setting back at false and asked them to try again and they said they again got the looping issue.

    Is the best place to setup the redirect in IIS or in the AppConfigs?

    Thanks.

  2. #2
    John Reasons is offline Senior Member
    Join Date
    Oct 2009
    Posts
    119

    Default

    By default is it designed to work on only the default.aspx page. You can add this behavior to all pages by adding the following (in red) to your \APP_Code\SkinBase.cs:

    Code:
            public SkinBase(String TemplateName)
            {
                if (AppLogic.IsAdminSite && AppLogic.OnLiveServer() && AppLogic.UseSSL() && !CommonLogic.IsSecureConnection())
                {
                    if (AppLogic.RedirectLiveToWWW())
                    {
                        HttpContext.Current.Response.Redirect("https://www." + AppLogic.LiveServer() + CommonLogic.ServerVariables("PATH_INFO") + "?" + CommonLogic.ServerVariables("QUERY_STRING"));
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect("https://" + AppLogic.LiveServer() + CommonLogic.ServerVariables("PATH_INFO") + "?" + CommonLogic.ServerVariables("QUERY_STRING"));
                    }
                }
                if (!AppLogic.IsAdminSite && AppLogic.OnLiveServer())
     	            {
     	                if (AppLogic.RedirectLiveToWWW())
     	                {
     	                    if (!HttpContext.Current.Request.Url.Host.StartsWith("www."))
     	                    {
     	                        if (CommonLogic.IsSecureConnection())
     	                        {
     	                            HttpContext.Current.Response.Redirect("https://www." + AppLogic.LiveServer() + CommonLogic.ServerVariables("PATH_INFO") + "?" + CommonLogic.ServerVariables("QUERY_STRING"));
     	                        }
     	                        else
     	                        {
     	                            HttpContext.Current.Response.Redirect("http://www." + AppLogic.LiveServer() + CommonLogic.ServerVariables("PATH_INFO") + "?" + CommonLogic.ServerVariables("QUERY_STRING"));
     	                        }
     	                    }
     	                }
     	            }

  3. #3
    jimmidude is offline Junior Member
    Join Date
    Nov 2009
    Posts
    11

    Default

    Thank for the information.

    I again asked the hosting company to install an IIS redirect and this time it worked.