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 »

Permalink 8 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

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

How to Deploy a Web Application in ASP.NET

October 26, 2006 at 12:00 pm (ASP.NET, Web Design)

To Deploy the Web Application You have created in ASP.NET follow the steps:-

1. Open the Web application project that you want to deploy. In this case,open the SampleVB project.

 2.Select File->New Project to open the New Project Dialog box.

3. From the Project Types pane, select Setup and Deployment Projects.From the Templates pane, select Web Setup Project.

4. Change the default name of the project. In this case, change it to “SampleVBDeploy.”

5. Click OK to complete the process. The project is added in the SolutionExplorer window. Also, a File System editor window appears to the left.The editor window has two panes. The left pane displays different items. The right pane displays the content of the itemselected in the left pane.

6. Select Web Application Folder in the left pane of the File System editor window
7.Then,from the File menu select Add -> Existing Website to open the Add Existing WebSite Dialog box.Choose the Web Application that you want to Deploy(In our case its SampleVB).The Web Application will be added in the Solution Explorer Window 8.Then, from the Action menu, select Add ® Project Output to open the Add Project Output Group dialog box.

9. Verify that SampleVB is selected in the Project drop-down list. Then,select Content Files from the list.

10. Click OK. The content files of the SampleVB project are added to the solution.

11. Select Web Application Folder in the File System editor and select Properties Window from the View menu to open the Properties window.

12. Set the VirtualDirectory property to a folder, <folder name>, that would be the virtual directory on the target computer where you want to install the application. By default, this property is set to SampleVBDeploy,which is the name of the Web Setup project that youadded. In this case, set the property to DeployedApplication.

Caution The <folder name> should be a new folder name and should not already exist on the target machine. Otherwise, the contents in the folder will be overwritten.
13. In the same Properties window of the Web Application Folder, set the DefaultDocument property to Default.aspx. This property is used to set the default Web Forms page for the application.

14. Build the solution by selecting Build Solution from the Build menu.

15. After the solution is built successfully, a SampleVBDeploy.msi file is created in the Debug directory of the Web Setup project. The default path is \documents and settings\<login name>\My Documents\VisualStudioProjects\SampleVB\SampleVBDeploy\Debug\
SampleVBDeploy.msi.

16. Copy the SampleVBDeploy.msi file to the Web server computer (c:\inetpub\wwwroot) where you want to deploy the application.

17. Double-click the SampleVBDeploy.msi file on the target computer to run the installer.

Note To run the installer, you must have the install permissions on the computer. And, to install to the Web server, you must have IIS permissions.

After the installation is complete, you can run your application on the target computer. Todo so, start Internet Explorer and enter http://<computer name or IP Address>/DeployedApplication in the address box.

Permalink 14 Comments

Time’s Up: Internet Explorer 7 Coming This Month – oct 2006

October 25, 2006 at 4:53 am (IE, Web Design)

Microsoft has announced that the final version of the browser will be released before the end of this month—that’s less than two weeks away, people!

In the weeks following this initial release, Microsoft will deploy the browser to all Windows XP users via Automatic Updates. Although the installation of IE7 will not be forced as it was for Windows XP Service Pack 2 (users will be able to postpone or cancel the update if they so desire), a message will appear recommending that users proceed with the installation, which most of them undoubtedly will.

Chris Wilson, group Program Manager of the Internet Explorer Platform team at Microsoft, spoke at the Fundamentos Web 2006 conference and implored the developers there to test their sites with IE7 and fix any issues that appeared. There are a number of people on the IE7 team that have put their jobs on the line by implementing the standards compliance fixes and CSS features that we have been demanding for years, in some cases breaking compatibility with sites that were designed for the browser’s previous nonstandard behaviour.

As the dominant browser, Internet Explorer has the potential to effectively break the Web if the sites that everyday users rely upon do not work correctly in this new version. Despite this, Microsoft has taken an enormous leap of faith by sacrificing compatibility in the name of standards compliance. It’s up to us as developers to ensure that this leap of faith pays off, so that we can continue to see improvements to standards compliance in future releases of Internet Explorer.

You’re not on your own, here. Microsoft has produced an impressive array of tools and documentation to help developers migrate their sites to IE7

Permalink 4 Comments

How an Ugly, Mistake-Ridden Web Site Outperformed a ‘Better’ Site

October 25, 2006 at 4:47 am (Web Design)

We recently  redeveloped a web site for a client who sells a service at $5,000 a pop. Our redeveloped site replaced a site that he’d designed himself, which had been up for 6 months. It was an ugly, ugly site.

Yet, during its first couple of weeks online, the new site came nowhere near achieving the sales levels of the old, ugly site. Why? The answer reveals a fascinating insight into how some web sites work.

The old ugly site was mistake-ridden. It offered very little information. In no way did it present the client’s services in a positive way. But it still outperformed the new site by a long way, for one simple reason.

As there was no information on the web site, people phoned up my client. He’s great on the phone and made sales to 80% of these callers. He even made a $5,000 sale to a visitor who rang him to tell him about a typo on his web site!

My new (and better?) web site answered many of the prospects’ frequently asked questions, offered a 3-part email autoresponder course, and provided a lot of great information that was useful to visitors trying to make a buying decision.

In fact, there was so much great information that prospects didn’t need to call. So they didn’t. They made their buying decisions based on the information that was provided on the web site and the sales dropped like a stone!

The lesson to be learned here is that success is not about having the best-looking web site, the one with the most information, or the site with the highest traffic levels. It’s about what works.

I’d better go. I’m off to remove a whole lot of useful content and add a phone number to a homepage!

We represents a Group of Web Developers …

Permalink Leave a Comment