More in this section

Forums / Developing with Sitefinity / Google Webmaster Tools errors

Google Webmaster Tools errors

6 posts, 0 answered
  1. Duncan Evans
    Duncan Evans avatar
    122 posts
    Registered:
    07 Jul 2009
    05 Sep 2009
    Link to this post
    I have been working hard to reduce the crawler error into my site to 0. Today 2 new ones poped up from site linking to pages on my site with a space behind the url:

    http://www.therecoveryplace.net/Chemical_Dependency_Program.asp%20

    What is the best way to handle this? Would i have to map a new file extension for asp%20? Is there no way SF or IIS can just ignore the space after the extension?

    Anyone have any ideas?

    Duncan
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    07 Sep 2009
    Link to this post
    Hello Duncan,

    I think that you could create a new HttpModule, which checks and strips space or %20 from the end of the URLs. Just register it first in the web.config file, so it could process the URLs before the others. 
    Let me know if you need help with this.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Duncan Evans
    Duncan Evans avatar
    122 posts
    Registered:
    07 Jul 2009
    07 Sep 2009
    Link to this post
    I would be eternally grateful. It is Labor Day here which is going to be my excuse for being lazy and asking for help! :)

    Thanks,

    Duncan
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    08 Sep 2009
    Link to this post
    Hello Duncan Evans,

    Alright, you can use the following module when the you have URLs with Url with query string (http://domain.com/page.asp?something%20):

    using System; 
    using System.Collections.Generic; 
    using System.Web; 
     
    namespace Sitefinity.Samples 
        /// <summary> 
        /// Summary description for UrlFilterModule 
        /// </summary> 
        public class UrlFilterModule : IHttpModule 
        { 
            #region IHttpModule Members 
     
            void IHttpModule.Dispose() 
            { 
            } 
     
            void IHttpModule.Init(HttpApplication context) 
            { 
                context.BeginRequest += new EventHandler(context_BeginRequest); 
            } 
     
            void context_BeginRequest(object sender, EventArgs e) 
            { 
                HttpContext context = HttpContext.Current; 
                string url = context.Request.Url.ToString(); 
                if (url != null
                { 
                    url = url.Trim(); //removes trailing whitespaces 
     
                    if (url.EndsWith("%20")) 
                    { 
                        url.Remove(url.Length - 3, 3); //cuts the last 3 characters from the string.     
                    } 
                } 
            } 
            #endregion 
        } 

    The problem when you do not have query string is that the request does not reach the application. So I guess, yes, you should map such extension too.

    All the best,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Duncan Evans
    Duncan Evans avatar
    122 posts
    Registered:
    07 Jul 2009
    11 Sep 2009
    Link to this post
    Neither of those options really does the trick. Is it possible to modify the error page to trim the url causing the error and redirect?

    Duncan
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Sep 2009
    Link to this post
    Hi Duncan Evans,

    The problem comes from the fact that these requests are not mapped to IIS, and we cannot access them. I am not sure how you are going to change the error page, perhaps you can track the request and Response.Redirect() to the same address but without the %20 ?

    On the other hand, adding a wildcard application mapping  to Asp.net ISAPI in IIS will redirect all requests with any extensions to Sitefinity. Then you can handle the URL via the Http Module or via the URL Rewriter.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered