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.
Related
ASP.NET 4.51, MVC 5
Have read Integrating a CMS into an established application-centric MVC website
We have a number of MVC applications that serve as public facing websites. The applications were built using MVC as that was the technology stack understood by the developers and primarily the content that was being delivered was based on business process data.
However more and more we are being asked to add "another page" to the websites which for all intents and purposes is a plain old static content page. This ultimately involves:
Adding a new route
Creating a view with the required HTML
We have various "home grown" solutions which now pull HTML from the database for these views. However this means we are writing custom back end data entry screens as well as 1 & 2 above.
So.... There must be a better way. Has anyone got any practical experience or suggestions on how to add simple CMS functionality that we can give to end users, plugged into our MVC application? We need to provide the following functionality to the end user:
Create new pages, edit pages using WYSIWYG
Add meta tags and canonical tags for SEO
Specify the url portion of the uri for SEO purposes
All insights appreciated.
Is it feasible to do the following:
Have a database table to house the content for these pages. e.g. title, summary, description, url, meta, image(s) etc...
In the front end have a template for these pages. The database data fills in the placeholders within this template.
Perhaps hold all the pages on a base URL like www.yoursite.com/page/dynamic-page-url-from-db
You can use the Remote attribute validation on the url field to make sure they are all unique in the database.
With this in mind, create a single Route to catch the requests and filter valid/invalid requests in the Page controller based on the URL provided with the db. If non-existent throw new HttpException(404, "Page Not Found"); and have an error handler pick that up and deliver your 404.
META could be set via ViewBag or a dedicated section that alters the _Layout file at the point of rendering the view.
TinyMCE is a decent WYSIWYG editor. You can even add dynamic image gallery functionality to it if you want to embed images within the main body of the pages.
I'm working on making a CMS currently used in a demanding production environment into a product. I've just (as of 20 Jan 2015) made a NuGet package which installs the CMS into an MVC project which should be possible to add to any existing MVC site without breaking it. CMS functionality can then be added where needed. Currently I'm looking to work with some users to help them get the CMS into production on their sites, however this may have changed by the time you read this. Look at http://www.lynicon.com for more information and to sign up to a Slack community where I can give you access to the NuGet package.
I am working on this ASP.NET MVC Project to which i am very new.
I did some worked somehow on normal ASP.NET Web Forms back in days but i am really a beginner in ASP.NET. I developing projects in php for quite time and did never got a chance to try out .NET.
Back To Question:
I want to have two Sections, One for Administrators and One for Front End Users.
I want both Front End Users and Administrator(BackEnd) Users To have Different Themes Different Controller and Different Models.
In Simple PHP i did made base Controller Named My_Controller which extends the main Controller.
And after that i created two more base controllers derived from this my_controllers namely
AdminController
FrontEndController
and moved this based controllers to core directory or library directory.
But How to achieve such a thing in ASP.NET MVC, I am using ASP.NET MVC 5 at the moment.
Currently i just created new project using MVC. and Here below is the Current File Structure for my Project
Also Please Also Share what will be a better approach that making the base controllers for Admin Controller and FrontEnd Controller.
Or having Multiple MVC Projects in a project of a solution. Like HMVC.
But most importantly what is the best approach and how to achieve this admin and frontend file Structure.
Possible Solution 1:
The Good idea might be to use Area Feature of Asp.NET MVC. Area generally used for the purpose of sepration of user base, like in your case Public user and admin user.
Well explained details of area's can be found on following documentation.
http://msdn.microsoft.com/en-us/library/ee671793%28VS.100%29.aspx
Regarding the different themes for Admin and user web app, you can simply use different Layouts. Put two layout inside the View > Shared folder. Then specify layout on each view as below.
For User Views
Layout = "~/Views/Shared/_UserLayout.cshtml";
For Admin Views
Layout = "~/Views/Shared/_AdminLayout.cshtml";
Possible Solution 2:
if your project is big enough to think it will be difficult to handle the Areas later in a single project, you can also split the User and Admin project.
But you should be aware of re-usability of the source code by placing such code (such as Models) in other projects and adding reference.
I hope this solves your problem.
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.
HI,
I have a ASP.NET webiste I created from craft and it now look a big mess. I want to reorganize this but don't know the good way to do it. Some first look well but later cause trouble with master page, image path...
Now I'm thinking of 2 ways:
Using UrlWriter: but it seems lead to a bulk of path rewrite and usually lead to Resource not found or something
Using a page as main entry and using Server.Tranfer to pull the right page content, despite of its location
Which is better? Do you have another method?
Please help!
There's another approach, System.Web.Routing, added in ASP.NET 3.5 SP1. Basically, you implement the IRouteHandler interface and manually route the request to an appropriate handler.
This is how ASP.NET MVC handles request routing. There's a guide here that uses it for Web forms.
By the way, consider looking at ASP.NET MVC and check if it's appropriate for your situation.
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.