Archives / 2010 / October
  • Session Lost in iFrame (P3P Issue)

    Problem: If you have iFrame or multiple frameset in your ASP.NET page, session is lost in the child frame.

    Session ID: If you use Response.Write to show the Session.SessionID of your page, you'd notice that it's actually changing on every postback.

    Cause: Due to the browser and Platform for Privacy Preferences (P3P) natures, the child frame will be considered as third party site if the top level domain is different between the parent and child frame. Therefore, default privacy settings of IE (medium) will be used and reject any cookies sent from the third party site (that is your child frame).

    Solution: Apart from altering the settings in IE (which may not be possible due to client company security reason as in my case), the easiest solution is to add a header to the base page and acknowledge it can trusted to the parent site.

    For example,

        public class BasePage : System.Web.UI.Page
            public BasePage() {}

            protected override void OnInit(EventArgs e)
                Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TATi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");



  • Automate Backup of SQL Express Databases

    It's a fact that no integration services and SQL agent available in SQL Express products, but it's a must to backup SQL Express databases in a timely basis. There is a very useful article describing how to do it with TSQL and Windows Schedule Tasks.

    1. Backup DB - Prepare a SQL script to backup database (Someone suggest using the Generate Script function in Management Studio from the Backup operation screen too)
    2. Housekeeping - Prepare a VBScript file to remove old backup files
    3. Execution - Prepare a batch file to execute #1 and #2
    4. Scheduling - Put #3 in Windows Task Scheduler



  • 2010 MVP Award

    Fantastic! This post is a memorable post for myself because I just got renewed on my MVP status in ASP/ASP.NET technology in 2010. :)

    Dear Colt Kwong,

    Congratulations! We are pleased to present you with the 2010 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in ASP/ASP.NET technical communities during the past year.