you can also do it by creating the javascript function and calling it in your cs code like this:
JavaScript function:
function ShowMessage()
{
alert('your message');
window.location.href='default.aspx';
}
CSharp code:
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "ShowMessage()", true);
hope it helps :)