Update asp.net Xml Sitemap - asp.net

The project I am working allows users to create pages in a CMS type system.
I would like to use an asp.net sitemap to reference these pages. So when a page is added or moved the Xml sitemap would be updated.
Is this a practical solution and are there any solutions available that work similar to this?

You should probably write your own SiteMapProvider see http://msdn.microsoft.com/en-us/library/ms178431.aspx that loads from your CMS.

Related

Aspx master page in MVC application

I know this is an old topic but i was wondering if a newer more elegant solution exists now. I am currently working with a legacy asp.net application and we are adding an MVC project to it. In order to keep uniformity we have been tasked with using the existing aspx master pages in our new project. This Article poses a viable solution. Has anyone found a newer, elegant, or more efficient way of achieving this goal?
I don't think there are new ways to integrate master pages.
Good approach is to have master page and _layout file that share most of the actual content via partial views/user controls as covered in Mixing Razor Views in WebForms.
Looked and looked and honestly could not find any one thing that would allow me to keep the look and functionality of my master page with links and functionality. We have decided to use ASPX pages with iframes that point to MVC pages. Eventually the point will be to eliminate the use of aspx master pages. Thanks everyone for great responses.

site.Master file does not esist

Probably a silly question, being new to development, I am following tutorials and find references to a site.Master file in many of the tutorials I have come across. Is this something that is autogenerated or must I create this file myself? I have access to vs2010 and 2012 and I don't see a site.Master file in any of my projects that i have started. There is however a _layout.cshtml file. I only ask as in every tutorial that mentions this file, doe not mention creating it, just that the file exists.
Here is the deal.
You are probably reading tutorials about MVC or MVC 2 where the view engine is aspx and master pages still are used as a template.
Since MVC 3 a new engine is introduced: Razor. Also this _Layout.cshtml page takes the role of Site.master (master page). With Visual Studio 2010/2012 if you select an MVC project it defaults to Razor syntax and includes _Layout.cshtml as a Shared View.
You can still follow these 'old' tutorials, but mind this difference and act accordingly when recreating the steps.
It could be auto generated if the template you created your project from included a master file. Look in the Solution Explorer (If the solution Explorer isn't visible, hit View -> Solution Explorer) and see if you have a file in your site that ends in the extension ".Master". If not, right click your project in the Solution Explorer then click Add New Item. On the left select your language (Visual Basic or C#) then in the right select Master Page. Give it a name at the bottom such as site.Master. Then click Add. You'll have a master page.
After that, you'll probably want to hook up your other pages to use the new master page. But I'll leave that to your tutorials.
ASP.NET Master Pages: http://msdn.microsoft.com/en-us/library/wtxbf3hh.ASPX
site.master files are usually auto-generated for you when you make a new default ASP.NET website in Visual Studio. Depending on where are in your project, you may need to create one yourself, if Master Pages is the route you want to take. They aren't mandatory, they just make things easier IMO.
MVC has no concept of a masterpage, and site.Master doesn't exist. If you find a reference to site.Master on a tutorial you are using 'regular' ASP.NET (or, as I like to call it, if I'm trying to be polite 'old-fashioned' ASP.NET), not ASP.NET MVC
Yes , It is auto-generated when you create a new ASP Website Project in VS

aspnet kendo sitemap (only) localization not working

I have a problem with sitemap localization. Whole app is localized properly but sitemap is not.
I would like to get any error information or know where to put breakpoint to know what is wrong.
I've been using this guide
E:
I forgot to mention that I'm using Kendo MVC Sitemap
Unfortunately it seems that localization of kendo sitemap is not possible at all, and you have to make separate sitemaps for each language ...

How can one build dynamic sitemaps in ASP.Net?

How can one build dynamic sitemaps in ASP.Net?
Sql Sitemap Provider
Physical file sitemap provider
You can take a look at these for ideas or just reuse them.
Not sure about your exact context (Forms or MVC, etc), but here are a couple of resources you can take a look at. You have several options, and I don't yet have the rep to post multiple links, so I'll post the google search link I did and call out a few links I found that could work for you.
http://www.bing.com/search?q=ASP.NET+Dynamic+sitemap&form=QBRE&qs=n&sk=&sc=1-23
Scan your site folder structure (using LINQ) and auto-gen a sitemap - 3rd Link (Creating Dynamic ASP.NET SiteMap using LINQ)
Implementing your own SiteMapProvider (MDSN) - 6th link (Implementing ASP.NET Site-Map Providers)
Implement and override the StaticSiteMapProvider - 4th Link (Adding dynamic nodes to ASP.NET site maps at runtime by deriving from ...)
SiteMapProvider for MVC - mvcsitemap.codeplex.com
Simple implementation using RouteTable values (MVC) - 10th link (Dynamic sitemap in ASP.NET MVC - Stack Overflow)
I hope these help, or point you inthe right direction. Feel free to comment with more details if you're looking for something more specific.

ASP.NET webpages without names, like stackoverflow?

Mentioned stackoverflow only as an example, but if you look above the URL for ask is
http://stackoverflow.com/questions/ask
which means /ask is a subdirectory, but they also do this for the specific question pages. How do you code this in .NET?
Not a code question as much as a technique. I know this is great for SEO, but how do you create a site so that every "page" is its own directory? Dynamically.
Do you have a template or a hidden redirect???
How?? :)
It's termed URL rewriting:
Url Rewriting with ASP.NET
MSDN: URL Rewriting in ASP.NET
EDIT: As #Justice points out, StackOverflow uses Routing.
StackOverflow uses something called Routing, which comes with .NET 3.5 SP1. Routing is a popular feature of a number of MVC frameworks, such as ASP.NET MVC, Ruby on Rails, and a number of Python and PHP frameworks.
Stack Overflow was built using ASP.NET MVC which uses a technique called Routing, see:
What Was Stack Overflow Built With?
and Routing
Stack Overflow uses ASP.net MVC
MVC uses the URL + Query String to determine the content, so its not like a URL which points to a specific page, but more like a hierarchical path to the properties of some data to be displayed
E.G. https://stackoverflow.com/users/[Put User ID Here]/[Put User Name Here]
prompts the website to display a USER with an ID specified in the path ( in this case the user name is probably just for kicks ) as opposed to a specific page created just for that user.
I have seen this accomplished by simply creating a folder for every web page and then having each folder contain a Default.aspx document (Assuming Default.aspx is setup as a default document in IIS, which it is by default). Then you can navigate to any folder on the site without specifying the page (Default.aspx).
For the dynamic part, I have worked with CMS systems that do it this way and the Default.aspx page simply inherits from some master template and the CMS system utilizes the ASP.NET rendering enginge to dynamically complete the web page.
Using folders may be a little heavy with the site structure, but it is an easy way to eliminate the page names from the browser.
This is how I structure my website and avoid having to use page names... for example http://www.innovaapps.net/Blog simply brings up the default.aspx page without having to specify the page name.

Resources