Find number of Days in a Month

How to find number of Days in a given Month from a web application or windows application? Copy one line of code in your page.

DateTime.DaysInMonth(Year,Month);
OR

Response.Write(DateTime.DaysInMonth(2010, 7));

The above line should display result as 31.

Add Website URL to your Favorites Menu from web application

How to add a website/webiste URL to your Favorites Menu from an application? You can copy below sample code to your .aspx page and you are all set.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddToFavoritesMenu.aspx.cs" Inherits="AddToFavoritesMenu" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function AddToFavoriteMenu() {
window.external.AddFavorite("http://www.webnetrevolution.blogspot.com", ".NET Sample Code");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="Click here to Add to favorites Menu.." onclick="AddToFavoriteMenu()" />
</div>
</form>
</body>
</html>



When you click the button on the webpage, it will prompt a nice InputBox (same InputBox when you click on ‘Add to Favorites…’ on your browser). You can change the defualt name or you can click on Add to add it in your favorites menu.