.Text Modifications - Revisited

posted on 2005-01-09 at 15:46:04 by Joel Ross

I was a little premature with my .Text modifications to get the www back into our URLs. I eventually reverted all code changes for that back to the original way it was done, and added the following line in the BlogConfigurationSettings section:

<UseWWW>true</UseWWW>

That's it. Much easier than what I was trying to do.

Well, almost. It doesn't work for the aggregate page. For that, I had to add one function to the code behind:

     1: protected string GetFormattedHost(string host, bool useWWW) {
     2:             if(useWWW) {
     3:                 return "www." +  host;
     4:             }
     5:             else {
     6:                 return host;
     7:             }
     8:         }

Then, in the GetFullUrl method, add this to the first line of the function:

     1: host = GetFormattedHost(host, true);

Now, all the links on the home page use www too, meaning our stats will start working again.

Categories: ASP.NET