Displaying HTML pages in an ASP.Net MVC Web App - html

I have a simple MVC site but I need to add in some static HTML pages, I have tried to add an IgnoreRoute in for .html files but this didn't work.

routes.IgnoreRoute("{resource}.html/{*pathInfo}"); worked for me. And place it before all other route definitions in your global.asax.

Related

How to convert Wordpress website to HTML static website?

at present I am using wordpress for my website https://propaura.com but I want to convert it to static HTML site ,how can I do?
and which is more better wordpress or HTML site.
I would suggest Httrack, but that would only copy the front end of the website. You still need to make it dynamic with PHP since it's built with WordPress.
Use This Plugin "Export WP Page to Static HTML/CSS"
And Export the full site as HTML with related pages linking

Github index.html and MVC

I seem to be running into a problem. I am wanting to upload my website to github but see that one needs to have the main page as index.html. This is an issue as i have created an empty ASP.NET MVC application with views and controllers that have the .cshtml tag.
How can I create an index.html as the main page and then call my other main page which will be a view, this way all I am doing is getting github to look at index.html and then my main page will be displayed? by index.html calling it.
I have tried to use the following as I saw them mentioned in a few other posts but can not seem to get it to work, I know that it did change my URL but still displayed index.html
routes.IgnoreRoute("");
Here is a picture of my project folder layout
Thanks for the the future reply's! Sorry if this post is a bit messy it is my first time posting here. TO add i am trying to host on gitHub through username.github.io
As far as I know Github does not support ASP.NET, but you can use a free Azure account. Take a look at:
http://www.asp.net/hosting
find answer by S.Spieker
kindly have a look on Deploying from ASP.Net MVC to GitHub Pages using AppVeyor if you want to do via AppVeyor

Can I still use `.cshtml` files in a hybrid mobile project?

All the resources use only HTML, but stuff like Cordova and Ionic work on the client, with HTML pages (and JavaScript and CSS of course), and once MVC has served a page, that page is HTML, so the hybrid tooling should be able to use it.
The only problem is that once it's served, it lacks the .html extension, but maybe I can figure a way to add this.
The reason I'd like to stick to .cshtml for my layout is that I can scaffold views from my sever-side view models, and this adds quite a lot of value for me.
If the question is: can you have .cshtml files on your mobile device, the answer is no. .cshtml file is processed on server by the Razor view machine, so plain HTML can be generated. Obviously you don't have MVC, Razor and such on your hybrid ionic app.
You can however work around it by taking your angular templates to be generated on your server by MVC. So, when you setup your templateUrl somewhere, instead of taking the relative path to your local template .html file, you can point to the controller on your server, giving the full path, with http:// and so. The controller will then generate your template for you and return as plain HTML.
Bear in mind, that angular will cache this, so it will be loaded only once.

Render plain html in Master Page web form

I'm writing a web application in ASP.NET Web Forms. I have a Master Page and I will include some knockout templates inside. For some structural reasons I don't want to add that templates inside the Master Page code directly, so they will be in differents files.
Structure.
Masterpage.master
template1.template.html
template2.template.html
template3.template.html
I have done the same thing in MVC, but it was easy just rendering partials.
Is there anyway to do the same thing with a helper class or something?
I need that code in every page that includes that Master Page.
Create a user control (.ascx) file and move the required markup out of your HTML files and into the ASCX files. Then register the controls (at the page or web.config level) and use them in your master page.
See Also: When do you need .ascx files and how would you use them?

Enable document footer

I tried to use Enable document footer function in IIS6 for my web sites
after some tests i discovered that it works for static files only
may i config it for pages like aspx or asp or maybe u have alternative solutions?
As you correctly point out, the IIS Document Footer feature only works with static files.
With ASP you could use include files:
<!-- #include file="footer.html" -->
The downside is that you'd need to add the include directive to all your ASP scripts.
If you're using ASP.NET you could use a HttpModule to inject a header and footer into every page. There's an example of how to do this on CodeProject:
Add a header and footer control to all web pages in a web application, using HTTP module
I downloaded the sample project and it works a treat.