Send mail to the author(s) E-mail

# Wednesday, 11 August 2010

A very good blog on transforms


Am transforming Connection strings now and Smtp

<add name="Sitefinity" connectionString="Data;Initial Catalog=secret;Persist Security Info=True;User ID=user;Password=password!"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />


<smtp from="">
<network port="25" host="" userName="" password="secret" xdt:Transform="SetAttributes" xdt:Locator="Match(port)" />

| | # 
# Monday, 09 August 2010

<script src="<%=HttpContext.Current.Request.ApplicationPath.EndsWith("/") ? HttpContext.Current.Request.ApplicationPath : HttpContext.Current.Request.ApplicationPath + "/" %>Res/Scripts/" type="text/javascript"> </script> 

I had a strange bug in Chrome where the css didn’t load properly using this in the masterpage.

           <asp:ScriptReference Path="" />
           <asp:ScriptReference Path="~/javascript/jquery.colorbox.js" />

This may have been a timing issue as I am now getting jquery from my website and not google.

| | # 
# Saturday, 07 August 2010

Makes it easier to deploy in VS2010 (using web.debug.config and web.release.config)

From the instructions here:

The biggest part is that SiteFinity uses User Profiles which are not available at design time in a web application (therefore it doesn’t compile).  To get around this we use the Web Profile Builder, which is a wrapper class which acts as a workaround.

This was the only code I had issue with:

//ProfileCommon profile = (ProfileCommon)ProfileCommon.Create(CreateUserWizard1.UserName, true);

WebProfile profile = new WebProfile(WebProfile.Create(CreateUserWizard1.UserName, true));
Then we convert to a Web Application.  The major difference is that in web sites each page has its code-behind compiled into a seperate library, whereas in a web application all code behind gets compiled into a single library.

There is a secondary file too called yourpage.aspx.designer.cs which moves all of the control declarations into it (a partial class).  This allows VS2k5, 2k8, 2010 to generate code without dumping into the main .cs class, and allows the class access to the controls on the page.

Used FileZilla and it all works.  Now, next post on VS2010 publishing / deploying!

| | # 
# Thursday, 05 August 2010

When displaying a repeater on an aspx page:

<asp:Repeater ID="Repeater1" runat="server">
<%#DataBinder.Eval(Container.DataItem, "FileName")%>

or shorter:

<asp:Repeater ID="Repeater1" runat="server">

It is important to remember to make FileName a property and not just a public field ie this works

public class ImageThing
public string FileName {get; set; }

private void DisplayThumbnailImages()
ImageThing imageThing1 = new ImageThing();
ImageThing imageThing2 = new ImageThing();
imageThing1.FileName = "asdf.jpg";
imageThing2.FileName = "aaa.jpg";

List<ImageThing> imagesToRender = new List<ImageThing>();

Repeater1.DataSource = imagesToRender;

this doesn’t

public class ImageThing
public string FileName;

A property encapsulates a field.

| | # 
# Wednesday, 04 August 2010

31mins.  He took a template from and put it into SiteFintiy

| | # 
# Saturday, 22 May 2010

I’m spiking out a website that needs to have users logging into the front end so they can see their own personal information.

They are using ASp.Net 2.0 Membership and Role Model.

Here is an example of using the same membership provider:




make a new project to play with

  • Home – visible in navigation
  • Groups – visible in navigation
  • Person – not visible in navigation, Page group
  • Login – not visible in navigation
  • Registration – not visible in navigation



    So have got registration and login working on the front end.


    how to display pages only to logged in users?




    Manage password


    just created a user control withPasswordRecovery and ChangePassword from  Then uploaded as an ascx user control.

    **how to get the specific user, so can query against them in the database in a custom control (see contacts example).


  • | | # 

    As the login in based on the .NET2 Membership Provider:


    Next step is to display the ‘races’ that the logged in user has competed in.

    Use a RADGrid approach and LinqToSQL


    **next is to do the linq query.

        need to do a where personID ==

    just using the grid or even a repeater.. kiss.


    Got it working, however am using

    <asp:LinqDataSource ID="LinqDataSource1" runat="server"
        ContextTypeName="Races.RacesDataClassesDataContext" TableName="races"
        Where="personID == @personID">
            <asp:ControlParameter ControlID="TextBox1" DbType="Guid"
                DefaultValue="63da93cb-1e76-4093-b74c-44503122d195" Name="personID"
                PropertyName="Text" />

    don’t need default value.


    ideally want to set this directly to the

    MembershipUser mUser = Membership.GetUser();
            string UserID = mUser.ProviderUserKey.ToString();

    Got this working:

    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) 
             MembershipUser currentUser = Membership.GetUser(); 
             Guid currentUserId = (Guid)currentUser.ProviderUserKey; 
             e.WhereParameters["personID"] = currentUserId; 

    <asp:LinqDataSource ID="LinqDataSource1" runat="server"
        ContextTypeName="Races.RacesDataClassesDataContext" TableName="races"
        Where="personID == @personID">
            <asp:ControlParameter ControlID="TextBox1" DbType="Guid"
                Name="personID"  />


    here is a trick for an error.. couldnt’ replicate.. discussed here:



    adding is a bit trickier:

    could just trying using the telerik Grid:

    hmm – getting string errors except when I wire up the where clause to a textbox which is not good!


    All good.. now trying to wire up the delete and edit which don’t seem to work with my select filter on LinqDataSouce.

    Looked at older code for custom edit screens based on backend of SF. 

    Try delete and edit with no filter where clause.

    All working once I sent the properties of the radGrid to do insert/update and delete.



    This took ages to find!

    Not working properly.,category,ContentManagementSiteFinityControls.aspx – interesting notes on delete.

    this would be nice:

    // never seems to hit this.
    public void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    if (e.Item is GridDataItem)
    GridDataItem dataItem = e.Item as GridDataItem;
    string DataItem = dataItem["nameOfRace"].Text;

    //Add the message to the Button
    LinkButton button = e.Item.FindControl("AutoGeneratedDeleteButton") as LinkButton;
    button.Attributes["onclick"] = "return confirm('Are you sure you want to delete " +
    DataItem + "?')";

    look at telerik RAD Grid add – we want to extend this method to put in the currently logged in users guid too.

    Testing RadGrid in a normal WebApp.  Trick is to copy in the design dll into the bin folder of the project otherwise VS will complain



    Good demos and code for LinqToSQL crud.. aiming to get the Add new record working and passing through the categoryID. – Scott Gu guide for LinqToSQL

    Now getting this when putting together a test web app using the telerik control, and linq to sql.  Strange!


    some stuff in here for probable fixes, however doesn’t feel right: – good manual for radgrid.

    Going through a video:

    Had to register my RadScriptManager to get things working.


    inline editing is good.


    try and put the sample from the video live – what are the licensing restrictions on the radcontrols I’m running?


    The Data context generated by the designer will live in the .Data namespace

    The Tables generated will live in the .Entities namespace.


    Adding a drop down for category in the grid… linked to another linqDataSouce not yet created


    now adding a RadComboBox.  AutoPostBack is true and Name is Name and ID is ProductCategoryID


    configuring the products data source to be conditional of the drop down combo box.


    The crowd goes wild :-)

    tidy up files  and remember what I am aiming to do.

    make live

      put database up there.. or 2 tables anyway.


    Why Use RADGrid?

    Go Live With RadGrid2

    As things never go to plan when going live…

    Remember to put in the Web.Design.dll into the bin directory (as we haven’t installed the tools into the GAC)

    Register the scriptmanager with web.config.


    Making the testgrid1 application live, and finding lots of issues with the too complex adventureworks2008 database

    **todo – make a simple version of this database with the existing products.

    Project is called TestRadGridTelerik2 – see work items for where I’m up to.

    | | # 

    Rough notes for Sitefinity. And how to develop easily custom modules (see end of post).

    Installing on Windows XP.. Had to use internet explorer to gefFt integrated authentication passing through properly:



    getting the correct user for the database.. tried to add the aspnet user into the database as an admin.


    this was a UI bug, just ran again F5 and it worked!



    The crowd goes wild :-)


    Deploying for shared hosting plan. – install guide

    backed up database on live server

    used SQL2008 Management Studio to do Create to Script and uploaded the database tables that way.

    Live site worked with just changing the connection string in web.config

    however the admin site won’t let me login.hmm if I changed the URL to:

    I then got a 404 error on editing a page,

    Second, you need to turn off healthMonitoring:
    <healthMonitoring enabled="false" heartbeatInterval="0">

    I then got a 404 again.. hmmm




    They have just turned off the Community Edition.

    Get going in visual studio – see support and live documentation.

    get going live on openhost – have sent an email.

    look at documents on the web showing how to do stuff in Sitefinity and case studies.

    how to embed controls and pages in SF – tutorial webcast?


    Changing the order of menu items

    properties of pages (ie whether they are listed in the menus)

    adding in images into pages

    permissions on pages


    eg RSS, Search…These are applications that other modules can use


    Generic Content – text and images


    publishing news

    pub date, expiration


    category, comments (shared with news and generic too)




    List of people in a company


    Polls, surverys – multi


    Images and Documents





    Added in 3.7

    strange renderiing issue.

    Generic Content

    can share content across the site.


    Categories – these are hierarchial.. these are different categories to other modules.

    Tags – these are flat level

    Permissions – who can do what.

    6:00 in and video died

    CntCatID ** didn’t work well


    Works fine.

    Master Page and Theming Video

    making a new master page and theme

    User Controls

    made an ascx using the Telerik RadTextBox


    created it in MyControls, then uploaded, which SF put in UserControls:


    Upload was at the bottom here, and it was put into Misc:


    Creating Custom Modules - Contacts

    Video here:

    code here":

    nolics.Engine.v4.2  dal

    references to Telerik.Cms.Web.UI – has exclamation mark

    also Telerik.Web.UI.. versioning?  Deleted the reference, and added in the new one, and it seems to work.

    Here is the management interface for the new contacts module:


    and the front end:


    and the full page:


    Working With SiteFinity API

    Simple User Control – blog form.

    News, Pages

    A custom page which programatically calls


    so we created a demo blog programatically through the SF API.



    User Management, Permissions and Workflow


    setting permissions for the news module for John (who is in the role News Role Special)


    And for Pages:


    Turning on Workflow:


    Made a page and now it is for approval by an admin:


    Adding Custom Fields

    Here he added in a price to an event, then hooked it up to a Google Checkout link.


    Other videos – Falafel – solution file

    ** am here

    Tricks with the SF API Video

    how to get solution coming up in explorer window?





    try dragging in Telerik.Web.UII.dll into VS to use the controls.

    Look at Linq contacts example.

    Modules – if need front end and back end

    User Control or Custom Control – if only need front end

    Tool – if only need back end.

    Custom Modules – Contacts – 26th Feb 2009.  3.6 Arch.

    this has 2projects in it:



    intra site module if don’t need the module across many implementations of SF


    Installed an older version of Contacts from 2007:

    no**how it accesses data?

    created 2 new tables in the db – smplt_Contacts and smpl_Departments

    added in some files:




    So now have:


    and can add/edit/delete from here:


    and data is going where we expect it:


    and wired up on the front end:


    and how to link to a details page:

    Intra Site Module 3.6 Version of Contacts using Nolics

    image – see telerik video_551pro.flv

    This is the easier and faster way to develop modules.

    ContactsModule is the central class which inherits from SecuredModule.

    Admin / ContactsCommandPanel (smaller panel on left


    Admin / ContactsControlPanel (larger control on the right)


    ContactsManager – middle man between presentation and data layer… so can put in another provicer eg for xml instead of database

    ContactProvider – abstract class.. sort of interface

    DAL.Contact.dbclass – nolics definition

    DAL.DefaultProvider – inherts the ContactsPRovider abstract class.  where stuff gets saved to orm.

    front end.web.config

    put in a custom module

    register module with SF

    declare a module section and declare the providers we will be using in that module.


    Intra Site Module Contacts – LINQ Provider (pre 3.6)


    highly recommended to use the new style of architecture.

    Contacts Intrasite (3.6) – ie not a pluggable module

    this doesn’t have the 3 projects..just simple code!



    create new SF website – yellow

    move virtual directory to c:\code\sitefinity\yellow

    load in a new solution in VS

    add into git.

    add in contacts module.

    create 2 new tables in the database… smpl_Contacts and smpl_Departments




    ContactsModule is the central class which inherits from SecuredModule.

    ContactsManager – middle man between presentation and data layer… so can put in another provicer eg for xml instead of database






    then in the web.config search for toolboxControls and add in after the <clear />

    <add name="Contacts List" section="Contacts" url="~/Modules/Contacts/Views/Frontend/ContactsListView.ascx" />
    <add name="Single Contact" section="Contacts" url="~/Modules/Contacts/Views/Frontend/SingleContactView.ascx" /> 

    Figure out how it works – front end first

    the user view simply has a SqlDataSource in it with SQL embedded in the page.


    Books Module (3.6)

    Also there is a books example based of the 3.6 new architecture:

    hmm – not quite the same format as contacts.

    Contacts Module LINQ (pre 3.6)

    **also need to look at the LINQ provider example in downloads – loos like same contacts example but using linq.

    Products Module (looks like 3.6) – pluggable module?



    RSS Service Module – 17th July 2009


    Video on Intra Site Module Creation _451

    Notes here:

    April 16th 2009

    Intra-Site module – code is stored in App_Code

    Uses LINQ

    To Create a new module all we need is: in App_Code\Contacts\ContactsModule.cs


    Command panel – left

    Control panel – right

    Wired Up control panel to an ascx




    Problem with Linq not recognising the FK Relationship.  Went into the diagram explorer in Sql server and it worked fine.


    Changed names to Department and Contact.  Set ID’s to be Auto Generated.

    Generic content - can take care of persisting the data for you in SF

    Here we are handing our data manually.

    problem referencing RAD Grid from telerik

    : 16min into video

    My toolbox is referencing 2010.1.309.35

    tried deleting the project assemblies:

    C:\Documents and Settings\[username]\Local Settings\Application Data\Microsoft\VisualStudio\9.0\ProjectAssemblies (Windows XP)

    trying to delete C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

    This worked!!!


    Using RADGrid.  2 LINQ Data Sources.  The first which is bound is to Contacts (which has crud working).  The second is to departments which is read only.


    putting in a DridDropDownColumn:



    The crowd goes wild.



    Doing the insert:


    So we can now create read update and delete to the contacts table via the backend of SF..we can read from another linked table too (department).  Using Linq to SQL so have written no SQL.  SF includes authentication.


    How to Manage Departments?


    Here we are using an asp:MultiView, a link button and


    However this method can get complex really quickly.. so going to look at 3.6 features:


    We have deleted the user control which was in Contacts called ControlPanel.ascx  and made 4 more granular ones.

    changed the ContactsModule from

    return parent.LoadControl("~/Custom/Modules/Contacts/ControlPanel.ascx");


    return new ContactsControlPanel();

    which is a new class which loads up the more granular ones



    The user controls need to inherit from:  ViewModeUserControl<ContactsControlPanel>

    This is a new concept in 3.6


    However we want slightly different views so:

    Create ContactsView and DepartmentsView which hold 2 children each.



    Make it look nicer:


    <MasterTableView CommandItemDisplay="Top" DataKeyNames="Id" CssClass="listItems" width="98%"

    added some divs:

    <div class="workArea">
        <div id="gridPlaceholder">

    Wiring up Add Button which is just an asp hyperlink.




    Added in  Linq code for add and edit.

    Added in a new view so when go to Add new Contact, it displays a nice breadcrumb.  Even though it actually goes to the edit view!



    Front end displaying the data.



    User Controls – Simplest way to bring in business logic.   inherit from System.Web.UI.UserControl.


    making the Control Title property editable by the back end.


    making the bulleted list editable (how it looks)

    Towards the end of the examples in the docs, it does persist data.

    **Ivans blogs on Control Designers?


    LinqCommere and Free Templates

    **review rest of flv videos

    How To Deploy Easily?

    This is a ‘Web Site’ and not a ‘Web Application Project’

    I usually do the pre build events in Projects to change my db connection stri9ng.

    **Look in the forums on SF site

    ** keep watching videos.

    **look on youtube for sitefinity

    **how to develop in SF – environemtn.. change to Web Application Project?

    read this sometime:

    ### It is fairly easy to develop a back end intra site module that does admin stuff.  Custom.  I went on to look at Telerik RAD Controls before writing this up.  There should be a good example sln.  There was a video which was excellent on intra site stuff.

    | | # 
    # Friday, 30 April 2010

    I’m using a Windows2008 shared server there.

    When I go

    2010-04-25 02:28:11 W3SVC3267 WINPLESK8 GET /Rejected-By-UrlScan ~/sitefinity/admin/pages.aspx?select=6bfb28b5-8858-40e0-b41c-c4de7377dc25 80 - HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-GB;+rv: .ASPNET=1AFB9766977A21A55E7B9BAF3F27FCCD8DAF9A049A7845DD4405823A6777D6E80FE4233EF6C403BEAAEA4E0E981AAD087B225606D56470A932DD82D59DDDD76DD0AF4C5BCB1A3ACCAD31BB26B8541EB84B1602F1834AC23A72327049A436D1C2;+ASP.NET_SessionId=mbucdi45fpa5ee55bddc5qy0;+.ASPXROLES=ipJFW4T_cJvPAYLQ5ZPJt3W3ZvEDmRcZaR65fdIMjQk4lclLmuzIb0-8SdEZtVinSUlefJlWwobKC3KhexUfFinsek_a-SavHnIQ2LZneONdBBZFDAxeSURWQiBvbIDY1WVktLDKeaYMpC5q1i36pGdXFoWZRAe_jSDPSPDqvCVLPma-BCUAq5dYtyFnHdgIYhKIg39XxHJvRao8sseVFm5DJLi0GSSGoEp4vgMh5EeK1KmgR0-pXiYTB5j4Rcap18QBjA2d8Bexcwr_Iugw41jm-ph9SCspbunO0ws1X6IC9ejiCCB5AydiKsKsYYQhcnLcXIOzFSspfOOYmm3RF1v6TnVv9xytzJzn14NP5Dh-h_wRYnWXbpM_hyfDTiVBEEvu1yFC6HMMD-PQ2BH_FzJ0SmWxKIoikslK6EG41KrFfwrcaRWyBDxkWoddsgVF0 404 0 2 1218 1231 468

    So it looks like a Rejected-By-UrlScan issue

    URLScan is configured to reject certain requests. URLScan.ini

    Another email to my providers who turned off URLScan for me.

    | | #