This project is read-only.
1
Vote

SubgurimSiteMapContextRequest.context_BeginRequest

description

Solution to resolve urlRewriting (code with comment //NEW)
 
private void context_BeginRequest(Object sender, EventArgs args)
    {
        var context = ((HttpApplication)sender).Context;
 
        var config
            = (SubgurimSiteMapConfiguration)ConfigurationManager.GetSection("SubgurimSiteMapConfiguration");
 
        var uri = context.Request.Url;
 
        if (SubgurimSiteMapUtilities.takeLocalPath() == config.sitemapResponse)
        {
            SubgurimSiteMapUtilities.showOnScreen(SubgurimSiteMapBLL.showSiteMap(), context.Response);
        }
        else if (!SubgurimSiteMapUtilities.IAmAutoCalling(context) && filter(config, ref uri))
        {
            //SubgurimSiteMapBLL.addSiteMap(uri.AbsoluteUri); OLD
            var schema = uri.Scheme; //NEW
            var host = uri.Host; //NEW
            var pathepag = context.Request.RawUrl; //NEW
            var urlCorretto = string.Format("{0}://{1}{2}",schema,host,pathepag); //NEW
 
            SubgurimSiteMapBLL.addSiteMap(urlCorretto); //NEW
        }
    }

comments