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
# Wednesday, July 01, 2009
Set “pageExtension” to nothing to tell SiteFInity to use Extension less URLs.

The line to change looks like this:
<cms defaultProvider="Sitefinity" pageExtension=".aspx" disabled="false" pageEditorUIMode="Overlay">
Change  it so that the pageExtension property is empty liek this: pageExtension=""

Note: The FormsAthentication and RoleManager modules are not available for extensionless request but you need them for the admin section of Sitefinity.

To enable FormsAthentication and RoleManager add the runAllManagedModulesForAllRequests property to the modules section of the Web.Config file.
E.G. <modules runAllManagedModulesForAllRequests="true">

Now you should have Extension less URLs in Sitefinity.

Wednesday, July 01, 2009 12:07:14 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Configuration
Archive
<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
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 2012
I do I.T. Ltd.
Sign In
Statistics
Total Posts: 27
This Year: 0
This Month: 0
This Week: 0
Comments: 22
All Content © 2012, I do I.T. Ltd.