Friday, June 24, 2011

Shrink Database

While working with MOSS and Project Server I noticed the physical hard disk size is growing rapidly and captured a lot of space. After opening the database files I found the DB log file taking huge space. 
 (Before)


Following Database script is executed on SQL Server to Shrink the size of the log files. It is very effective to reduce the size.
USE XXX_MOSS_Config
GO
ALTER DATABASE XXX_MOSS_Config SET RECOVERY SIMPLE
DBCC SHRINKFILE(N'XXX_MOSS_Config_log', 1)
ALTER DATABASE XXX_MOSS_Config SET RECOVERY FULL
GO

 (After)
Cheers!!!

Creating Custom Application Pages in MOSS

On a development cycle, you might need to create several custom Application Pages, which will be stored in Layouts\FolderName\YourPage.aspx.


While creating the page the base class need to inherit is "LayoutsPageBase"
Here is a blog specified about the steps for creating the pages.


Now, the challenge is, when you create such Application page for Anonymous Access, the user  asked for a log in. Means the Anonymous user redirected to the login page. 


To avoid such scenario, there is another base class need to inherit "UnsecuredLayoutsPageBase"
The code of the page will look like this:

protected partial class CustomPage : UnsecuredLayoutsPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}
On the same page, following method also need to be added for smooth functioning:
protected override bool AllowAnonymousAccess
{
   get
   {
       return true;
   }
}
Cheers!!
Somu