Asp Dot Net Notes for Web Masters RSS 2.0
# Saturday, November 28, 2009
In Sitefinity, when editing a page if you click properties you can enter extra page URLs.

Add a new URL something like "~/home.html" and click Save Changes.

Then Make all html pages run as though Asp.Net pages. Look here.

http://dotnetnotes.i-do-it.com/2009/11/28/MapHTMLPagesThrougthASPNETDllRunHtmlPagesWithAspnetisapidll.aspx


Then add this to the Global.Asax
 void Application_Error(object sender, EventArgs e) 
    {        
//Redirect missing Old html Pages to the default url of that page. Add Additional Urls to pages in sitefinity to redirect to those pages.
        Exception lastException = this.Server.GetLastError();
        if (lastException is HttpException)
        {
            HttpException httpException = (HttpException)lastException;
            if (httpException.GetHttpCode() == 404)
            {
                // get the name of the requested page - just the /thisPage.htm or /DIR/thisPage.asp etc
                string pageName = string.Concat("~", Request.Url.AbsolutePath.ToString());

                // create a new instance of CmsManager
                Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();

                // let's get the page by passing one of it's additional url's
                Telerik.Cms.IPage myPage = cmsManager.GetPageByAdditionalUrl(pageName);

                // we can cast myPage as ICmsPage and redirect to the Default URL
                if (myPage != null)
                {
                    //If there isa default page then redirect to it.                    
                    this.Server.ClearError();                    
                    Response.Redirect(((Telerik.Cms.ICmsPage)myPage).DefaultUrl.Url);
                }
            }
        }
    }

Saturday, November 28, 2009 12:01:48 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Configuration
Archive
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
I do I.T. Ltd.
Sign In
Statistics
Total Posts: 23
This Year: 2
This Month: 0
This Week: 0
Comments: 1
All Content © 2010, I do I.T. Ltd.