• Home
  • Privacy Policy
  • Terms & Conditions
  • Contact
  • Advertise
Videos, Photos, Wallpapers, Free Download, Movies, Songs, Sports , Live TV, Entertainment
 
  • Home
  • Bollywood
  • Hollywood
  • Box Office
  • Beauty
  • Fashion
  • Celebrity
  • Business
    • Social Media
    • Money Online
    • Category
  • Entertainment
    • Bollywood
  • Video
    • Youtube
    • Video
  • Technology
    • Asp.net
    • C#
    • SQL
    • .Net
Showing posts with label sitemap. Show all posts

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="Index.aspx" title="Home"  description="Home Page">
      <siteMapNode url="SportNews.aspx" title="Sports" description="Sports News">
        <siteMapNode url="BreakingNews.aspx" title="Breaking"  description="Breaking News" />
        <siteMapNode url="WorldNews.aspx" title="World"  description="World News" />
        <siteMapNode url="BussinessNews.aspx" title="Bussiness"  description="Bussiness news" />
        <siteMapNode url="TopNews.aspx" title="TopNews"  description="Top News" />
      </siteMapNode>
      <siteMapNode url="DataToolBox.aspx" title="DataToolBox" description="DataToolBox controls">
        <siteMapNode url="ListViewExample.aspx" title="ListView"  description="ListView Example" />
        <siteMapNode url="GridViewExample.aspx" title="GridView"  description="GridView Example" />
      </siteMapNode>
      <siteMapNode url="NavigationToolbox.aspx" title="Navigation Toolbox" description="NavigationToolbox controls">
        <siteMapNode url="MenuExample.aspx" title="Menu"  description="Menu Example" />
        <siteMapNode url="SiteMapPathExample.aspx" title="SiteMapPath"  description="SiteMapPath Example" />
        <siteMapNode url="TreeViewExample.aspx" title="TreeView"  description="TreeView Example" />
      </siteMapNode>
    </siteMapNode>
</siteMap>
Google provides a free service, named Google SiteMaps, that you can use to monitor and improve the way that Google indexes the pages on your website. For example, you can use Google SiteMaps to discover which Google search queries have returned pages from your website and the ranking of your pages in Google search results. You also can use Google SiteMaps to view any problems that the Google crawler encounters when indexing your site.

You can sign up for Google SiteMaps by visiting the following URL:
http://www.google.com/webmasters/sitemaps

To use Google SiteMaps, you must provide Google with the URL of a Google SiteMap file hosted on your website. The Google SiteMap file is an XML file that contains a list of URLs you want Google to index.

The Google SiteMap XML file has the following format:
<urlset xmlns=”http://www.google.com/schemas/sitemap/0.84”>
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
</url>
<url>
<loc>http://www.example.com/sample.html/</loc>
<lastmod>2006-03-11</lastmod>
</url>
</urlset>

The Google SiteMap file contains a simple list of <url> elements that contain <loc> elements representing the location of the URL and <lastmod> elements representing the last modified date of the URL.

The Google SiteMap file also can contain <changefreq> and <priority> elements.The <changefreq> element indicates how frequently a URL changes, and the <priority> element represents the priority of a URL relative to other URLs in your site. These elements are optional and are ignored here.

<%@ WebHandler Language=”C#” Class=”PublicSiteMap” %>
using System;
using System.Web;
using System.Xml;
using System.Text;
using System.IO;
public class PublicSiteMap : IHttpHandler {
private XmlWriter _xmlWriter;
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = “text/xml”;
XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = Encoding.UTF8;
settings.Indent = true;
_xmlWriter = XmlWriter.Create(context.Response.OutputStream,settings);
_xmlWriter.WriteStartDocument();
_xmlWriter.WriteStartElement(“urlset”,”http://www.google.com/schemas/sitemap/0.84”);
// Add root node
AddUrl(SiteMap.RootNode);
// Add all other nodes
SiteMapNodeCollection nodes = SiteMap.RootNode.GetAllNodes();
foreach (SiteMapNode node in nodes)
AddUrl(node);
_xmlWriter.WriteEndElement();
_xmlWriter.WriteEndDocument();
_xmlWriter.Flush();
}
private void AddUrl(SiteMapNode node)
{
// Skip empty Urls
if (String.IsNullOrEmpty(node.Url))
return;
// Skip remote nodes
if (node.Url.StartsWith(“http”, true, null))
return;
// Open url tag
_xmlWriter.WriteStartElement(“url”);
// Write location
_xmlWriter.WriteStartElement(“loc”);
_xmlWriter.WriteString(GetFullUrl(node.Url));
_xmlWriter.WriteEndElement();
// Write last modified
_xmlWriter.WriteStartElement(“lastmod”);
_xmlWriter.WriteString(GetLastModified(node.Url));
_xmlWriter.WriteEndElement();
// Close url tag
_xmlWriter.WriteEndElement();
}
private string GetFullUrl(string url)
{
HttpContext context = HttpContext.Current;
string server = context.Request.Url.GetComponents(UriComponents.SchemeAndServer,UriFormat.UriEscaped);
return Combine(server, url);
}
private string Combine(string baseUrl, string url)
{
baseUrl = baseUrl.TrimEnd(new char[] {‘/’});
url = url.TrimStart(new char[] { ‘/’ });
return baseUrl + “/” + url;
}
private string GetLastModified(string url)
{
HttpContext context = HttpContext.Current;
string physicalPath = context.Server.MapPath(url);
return File.GetLastWriteTimeUtc(physicalPath).ToString(“s”) + “Z”;
}
public bool IsReusable {
get {
return true;
}
}
}

You can think of an HTTP Handler is a lightweight ASP.NET page. You learn about HTTP Handlers in Chapter 27, “Working with the HTTP Runtime.”

<urlset xmlns=”http://www.google.com/schemas/sitemap/0.84”>
<url>
<loc>http://localhost:1104/SiteMaps/Default.aspx</loc>
<lastmod>2005-10-30T03:13:58Z</lastmod>
</url>
<url>
<loc>http://localhost:1104/SiteMaps/Products/Default.aspx</loc>
<lastmod>2005-10-28T21:48:04Z</lastmod>
</url>
<url>
<loc>http://localhost:1104/SiteMaps/Services</loc>
<lastmod>2005-10-30T04:31:57Z</lastmod>
</url>
<url>
<loc>http://localhost:1104/SiteMaps/Employees/Default.aspx</loc>
<lastmod>1601-01-01T00:00:00Z</lastmod>
</url>
<url>
<loc>http://localhost:1104/SiteMaps/Products/FirstProduct.aspx</loc>
<lastmod>2005-10-30T03:43:52Z</lastmod>
</url>
</urlset>

When you sign up at the Google SiteMaps website, submit the URL of the PublicSiteMap.ashx file when you are asked to enter your SiteMap URL. The Google service retrieves your SiteMap from the handler automatically.


ASP.NET Menu Control

The ASP.NET Menu control allows you to develop both statically and dynamically displayed menus for your ASP.NET Web pages. You can configure the contents of the Menu control directly in the control, or you can specify the contents by binding the control to a data source.
Without writing any code, you can control the appearance, orientation, and content of an ASP.NET Menu control. In addition to the visual properties exposed by the control, the control supports ASP.NET control skins and themes.

ASP.NET SiteMapPath

The SiteMapPath displays a navigation path (which is also known as a breadcrumb or eyebrow) that shows the user the current page location and displays links as a path back to the home page. The control provides many options for customizing the appearance of the links.

The SiteMapPath control obtains navigation data from a site map. This data includes information about the pages in your Web site, such as the URL, title, description, and location in the navigation hierarchy. Storing your navigation data in one place makes it easier to add and remove items in the navigational menus of your Web site.

In earlier versions of ASP and ASP.NET, when you added a page to your Web site and then added a link to that new page from every other page in the Web site, you had to add the links manually, include a common file, or develop custom navigation functionality. ASP.NET version 2.0 includes navigation controls that make navigational menus easy to create, customize, and maintain.
File extensions associated with different versions of ASP.NET include:

.asax : Global.asax, used for application-level logic

.ascx : Web UserControls: custom controls to be placed onto web pages.

.ashx : custom HTTP handlers.

.asmx : web service pages. From version 2.0 a Code behind page of an asmx file is placed into the app_code folder.

.axd : when enabled in web.config requesting trace.axd outputs application-level tracing. Also used for the special webresource.axd handler which allows control/component developers to package a component/control complete with images, script, css etc. for deployment in a single file (an 'assembly')

.config : web.config is the only file in a specific Web application to use this extension by default (machine.config similarly affects the entire Web server and all applications on it), however ASP.NET provides facilities to create and consume other config files. These are stored in XML format.

.cs/vb : Code files (cs indicates C#, vb indicates Visual Basic). Code behind files (see above) predominantly have the extension ".aspx.cs" or ".aspx.vb" for the two most common languages. Other code files (often containing common "library" classes) can also exist in the web folders with the cs/vb extension. In ASP.NET 2 these should be placed inside the App_Code folder where they are dynamically compiled and available to the whole application.

.dbml : LINQ to SQL data classes file

.master : 2.0 master page file

.resx : resource files for internationalization and localization. Resource files can be global (e.g. messages) or "local" which means specific for a single aspx or ascx file.

.sitemap : sitemap configuration files. Default file name is web.sitemap

.skin : theme skin files.

.svc : Windows Communication Foundation service file

browser : browser capabilities files stored in XML format; introduced in version 2.0. ASP.NET 2 includes many of these by default, to support common web browsers. These specify which browsers have which capabilities, so that ASP.NET 2 can automatically customize and optimize its output accordingly. Special .browser files are available for free download to handle, for instance, the W3C Validator, so that it properly shows standards-compliant pages as being standards-compliant. Replaces the harder-to-use BrowserCaps section that was in machine.config and could be overridden in web.config in ASP.NET 1.x.
Older Posts Home

ASP.NET Examples

 
2012 24x7 Magazine. All rights reserved.
Designed by 24x7 Magazine