Configuring Multiple Sitemaps in .NET

December 7, 2007 at 1:12 pm (.NET, ASP.NET, Web Design)

Sitemaps are used to describe the structure of the site so that the site navigation controls such as menu, treeview etc can use it to display the site structure properly. Generally the owner of the site will want to display a separate navigation for anonymous and logged users. For this the menu structure will vary. In this case we can use multiple sitemaps to display the appropriate menu based on user.

For using multiple sitemaps you need to configure the sitemap in the web.config file. We will learn this through an example. Suppose we need to site that allows the logged user to buy the product and the anonymous user is allowed only to browse the product. For this we need to display buy & browse in the menu for the logged user and browse for anonymous user. To implement this we can use multiple sitemaps.

Create a new website and add the two sitemaps for this namely logged and anonymous. In the logged.sitemap add two sitemap nodes, Browse and Buy. In the anonymous.sitemap create only one sitemap node, Browse. Read the rest of this entry »

Advertisements

Permalink 8 Comments

Creating own run command in Windows

December 7, 2007 at 11:51 am (Technical, Tips and Tricks)

Many tech guys would be thinking of creating their own run command. Yes !!! we can create our own run command.

Step 1: Create the shortcut for the folder or tool for which you need to create the shortcut.

Step 2: Open the run command and goto \Windows

Step 3: Paste the shortcut to that folder and change the name of the shortcut to run command as we want.

Now we can open the folder or tool from run command using the name we have given for the shortcut.

Permalink 19 Comments

Designing Menu using Sitemap and asp menu control

December 6, 2007 at 1:25 pm (.NET, ASP.NET, Web Design)

Menu can also be designed using the sitemap and the asp menu control. For this first the structure of the menu need to be designed first. Then web.sitemap for the menu is designed. web.Sitemap is an XML file that should be stored in the root directory of the website. It contains a root node <siteMapNode>. This node in turn contains multiple sitemap node for each menu item. Sitemap node has the following important attributes title, url and description.

Title : specifies the text need to be displayed on the page.

Url : Specifies the link path.

description : Specifies the tooltip text.

Part of web.sitemap is displayed below:-

<?xml version=”1.0″ encoding=”utf-8″ ?>
<siteMap xmlns=”http://schemas.microsoft.com/AspNet/SiteMap-File-1.0&#8243; >
<siteMapNode>
<siteMapNode url=”” title=”Tour Resources” description=”Tour Resources” >
<siteMapNode url=”” title=”Route Notes &amp; Tour info” description=”Route Notes and Tour info”>
<siteMapNode url =”../et_uk_rns.aspx” title =”Route Notes ET” description =”Route Notes ET”/>
<siteMapNode url =”../gat_rns.aspx” title =”Route Notes GAT” description =”Route Notes GAT”/>
<siteMapNode url =”../tour_summaries.aspx” title =”Tour Summaries” description =”Tour Summaries”/>
<siteMapNode url =”../tour_schedules.aspx” title =”Tour Schedules” description =”Tour Schedules”/>
</siteMapNode>
<siteMapNode url=”../educationlm.aspx” title=”Educational Material” description=”Educational Material”></siteMapNode>
<siteMapNode url=”” title=”Free Time Posters” description=”Free Time Posters”>
<siteMapNode url =”../et_cityins.aspx” title =”Free Time Posters ET” description =”Free Time Posters ET”></siteMapNode>
<siteMapNode url =”../gat_cityins.aspx” title =”Free Time Posters GAT” description =”Free Time Posters GAT”></siteMapNode>
<siteMapNode url =”../cb_cityins.aspx” title =”Free Time Posters CB” description =”Free Time Posters CB”></siteMapNode>
</siteMapNode>
<siteMapNode url=”../extrawts.aspx” title=”Walking Tours” description=”Walking Tours”></siteMapNode>
<siteMapNode url=”” title=”TD Travel” description=”TD Travel”>
<siteMapNode url =”../tdovernight.aspx” title =”TD Overnights” description =”TD Overnights”></siteMapNode>
<siteMapNode url =”../tdflights.aspx” title =”TD Flights” description =”TD Flights”></siteMapNode>
</siteMapNode>

Then in the page where the menu need to be displayed, we need to use asp SiteMapDataSource control. Then we can use asp menu control and point the DatasourceId to the above SiteMapDataSource.

Sample Code:-

<asp:Menu DataSourceID=”SiteMapDataSource1″ ID=”Menu1″ runat=”server” BackColor=”#FFFFFF” BorderColor=”#F57F2C” BorderWidth=”1px” DynamicHorizontalOffset=”2″ StaticSubMenuIndent=”10px” >
<DynamicMenuStyle BackColor=”White” BorderColor=”#F57F2C” BorderWidth=”1px” />
<StaticMenuItemStyle BorderColor=”#F57F2C” BorderWidth=”1px” HorizontalPadding=”5px” VerticalPadding=”2px” />
<DynamicMenuItemStyle BorderColor=”#F57F2C” BorderWidth=”1px” HorizontalPadding=”5px” VerticalPadding=”2px” Font-Bold = “true” Font-Italic = “true” Font-Names = “verdana” Font-Size = “small” />
<%– <StaticSelectedStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White” />
<DynamicSelectedStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White”/> –%>
<StaticHoverStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White” />
<DynamicHoverStyle BackColor=”#F57F2C” ForeColor=”White”/>
</asp:Menu>
<asp:SiteMapDataSource ID=”SiteMapDataSource1″ Runat=”server” ShowStartingNode=”false”/>

ShowStartingNode : It specifies that the sitemapdatasource should not display the root node in the menu.

Note:-

SiteMapDataSource will get the data from web.sitemap automatically.

Permalink 21 Comments

Retrieving Files from Master Boot Record malformed HDD

December 6, 2007 at 1:01 pm (Tools)

My system in office got affected by virus and it restarted. After restaring it displayed “Missing Operating System”. I did not understood it first and later remembered that one of my friend too had went through the same problem. I remembered him saying that a virus has attacked his system and has affected the master boot record, making the harddisk unusable. Master boot record stores the critical information about the partition in the hard disk.

I had some important project files stored in the system and i did not had any backup. I was tensed as i spent 30 days to design those 80 pages in the project. Finally i connected the HDD as secondary to another computer and started to explore that damaged HDD. It prompted to format the drive. I got tensed further as i was not sure that we can retrieve the files after formatting. Finally i googled a lot and found many tools to retrieve the files. But none was successful.

The next day i found a tool “Power Data Recovery” which is available here. I downloaded the trail version and scanned the damaged HDD using the tool.

This tool took about one and half hour to scan the disk and then displayed the files in it. I then tried to retrieve all the project files at a time. It prompted that “This is a Demo version so it can retrieve files that has size less than 630 KB”. Then i retrieved each file one by one and finally a smile appeared on my face.

Permalink 2 Comments

Static menu using asp:menu control

December 6, 2007 at 12:25 pm (.NET, ASP.NET, Web Design)

Last week i explored asp menu control and found it very useful to build the menu. The asp menu control can be used to display the menu vertically or horizontally. Menu items need to be displayed under the <items> section. Each menuitem is specified using the <asp:menuitem> tag. Multiple level menus can be easily designed using the asp menu control. The code i designed for the menu is shown below:-

<asp:Menu ID=”Menu1″ Orientation = “Vertical” runat=”server” BackColor=”#FFFFFF” BorderColor=”#F57F2C” BorderWidth=”1px” DynamicHorizontalOffset=”2″ StaticSubMenuIndent=”10px” >


<DynamicMenuStyle BackColor=”White” BorderColor=”#F57F2C” BorderWidth=”1px” />


<StaticMenuItemStyle BorderColor=”#F57F2C” BorderWidth=”1px” HorizontalPadding=”5px” VerticalPadding=”2px” />


<DynamicMenuItemStyle BorderColor=”#F57F2C” BorderWidth=”1px” HorizontalPadding=”5px” VerticalPadding=”2px” Font-Bold = “true” Font-Italic = “true” Font-Names = “verdana” Font-Size = “small” />


<StaticSelectedStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White” />


<DynamicSelectedStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White”/>


<StaticHoverStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White” />


<DynamicHoverStyle BackColor=”#F57F2C” ForeColor=”White”/>
<Items>

<asp:MenuItem Text=”Page 1″ NavigateUrl=”Page1.aspx”>
<asp:MenuItem Text=”Page 1-1″ NavigateUrl=”Page1-1.aspx”/>
<asp:MenuItem Text=”Page 1-2″ NavigateUrl=”Page1-2.aspx”/>
</asp:MenuItem>
<asp:MenuItem Text=”Page 2″ NavigateUrl=”Page2.aspx”>
<asp:MenuItem Text=”Page 2-1″ NavigateUrl=”Page2-1.aspx”/>
<asp:MenuItem Text=”Page 2-2″ NavigateUrl=”Page2-2.aspx”/>
</asp:MenuItem>
<asp:MenuItem Text=”Page 3″ NavigateUrl=”Page3.aspx”>
<asp:MenuItem Text=”Page 3-1″ NavigateUrl=”Page3-1.aspx”/>
<asp:MenuItem Text=”Page 3-2″ NavigateUrl=”Page3-2.aspx”/>
</asp:MenuItem>

</Items>
</asp:Menu>

you can view the menu i designed below:-

Menu using aspmenu control

Important Attributes :-

=======================

Orientation attribute : The orientation attribute specifies whether the menu need to be displayed vertically or horizontally.

DynamicHorozontalOffset attribute : It specifies number of pixels to shift a dynamic menu horizontally relative to its parent menu item. The default is 0. Read the rest of this entry »

Permalink 4 Comments