ASP.NET Web Site Administration Tool

The ASP.NET Web Site Administration Tool / Membership Provider which is used along with the SQL Server Membership Database, is no longer available in VS 2013 because the Cassini web server is no longer supported. You can either get the Web Site Admin Tool up and running using a command window or set it up in IIS.  This post covers both cases (I prefer to use IIS vs. Command Window).

Other Tools: If you looking for a tool to manage users with ASP.NET Entity take a look at ASP.NET Membership Reboot.  At this link is another approach using Identity Manager and discusses Membership Reboot as well. 
 

 
1. Launch the Web Site Admin Tool using a command window:
  • Open a Command Window running it as a Admin
  • Change the folder to IIS Express cd C:\Program Files\IIS Express\
  • Run the following command to start up IIS Express
    • iisexpress.exe /path:C:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/ASP.NETWebAdminFiles" /port:8082 /clr:4.0 /ntlm
  • Access the Admin Site via the following URL:
    • http://localhost:8082/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\[YOUR SITE PATH HERE]\&applicationUrl=/ 
 
2. Launch the Web Site Admin Tool using IIS:  You can try running the site from the Windows folder but after a couple of issues I just moved it to another folder.  The steps below cover that process.
  • Copy the Admin Site from the following folder: C:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles
  • Change the web.config to allow any user to access the site  <allow users="?" />
  • Setup the site in IIS. Set the Authentication as shown below.  Use the following URL to manage your ASP.NET site. 
  • http://localhost/ASPNetAdmin/default.aspx?applicationPhysicalPath=C:[YOUR SITE PATH HERE]\&applicationUrl=/
 

Resize iFrame Content Automatically

I recently had a need to re-size the content of iFrames for a site that uses iFrame for various reasons. 

This is not an original work but a collection of demos and sample code.

1. jQuery Sample: Jscheuer1 at Dynamic Drive has the most usable example (IMO).  Use the links below for the online demo and to download the code.
2. iFrame content on other domains: In order to re-size iFrames the iFrame content page you are rending needs to be on the same domain, or you have to have some control over the page that contains the iFrame content.  In the case where the page is not on the same domain, but you own the code this link at CSS-TRICKS goes into how to set this up. 

Sort BlogEngine.net Page List by Title

Here is a code snippet to sort Blogengine.net page list.
You want to modify the following C# file: BlogEngine\BlogEngine.NET\AppCode\Controls\PageList.cs
LINQ used to sort the pages and changed the Foreach loop to use the LINQ query.
private static HtmlGenericControl BindPages()
{
    var ul = new HtmlGenericControl("ul") { ID = "pagelist" };
    ul.Attributes.Add("class", "pagelist");

    //Sort pages
    var MyPages = BlogEngine.Core.Page.Pages.AsEnumerable()
        .OrderBy(x=> x.Title);
     
    //foreach (var page in BlogEngine.Core.Page.Pages.Where(page => page.ShowInList && page.IsVisibleToPublic ))
    foreach (var page in MyPages.Where(page => page.ShowInList && page.IsVisibleToPublic))
    {
        var li = new HtmlGenericControl("li");
        var href = page.RelativeLink;
        if (BlogSettings.Instance.RemoveExtensionsFromUrls && !string.IsNullOrEmpty(BlogConfig.FileExtension))
            href = href.Replace(BlogConfig.FileExtension, "");
        
        var anc = new HtmlAnchor { HRef = href, InnerHtml = page.Title, Title = page.Description };

        li.Controls.Add(anc);                
        ul.Controls.Add(li);
    }
    
    return ul;
}