Subdomain does not load scripts and styles - asp.net-mvc

Good afternoon,
1- I created a new solution in Visual Studio 2012
2- I created ASP.NET MVC 4 Web Application. I opted for one project "BASIC" and the Framework 4.5, Razor Engine
3- I created the controller Home
4- I created a View Index.cshtml
The content of Index.cshtml page is only a " Index "
I did nothing, just the main content of a project "BASIC".
Published, see the result:
www.meudominio.com.br -> loads the scripts and styles
imobiliaria589s42d78.meudominio.com.br/ -> NOT load scripts and styles
What should I do to make the subdomain load scripts and styles?
I appreciate the help.

I am not seeing any issues with styles not loading, so I presume this is an issue with caching in your browser. You can force most browsers to reload cached resources by pressing
CTRL + F5

Related

How to implement the Gentelella Bootstrap Admin theme in ASP.NET MVC?

I'm starting now with web development in Visual Studio. I have already understood MVC, I have some knowledge of HTML and I started to study the bootstrap.
Then, I discovered the beautiful template Free Bootstrap 3 Admin Template on the web, which has an example online here: https://colorlib.com/polygon/gentelella/index.html
I downloaded the files like custom.css and custom.min.css as they are shown in the following image:
But now I don't know how to put it in my project, so I created a new clean project in Visual Studio Community 2015. I did some tests, and I created some controllers and views.
How can I change the default bootstrap theme that came with ASP.NET MVC project to the downloaded one?
I imagine I should replace the _Layout in the shared folder. But what else should I bring?
I do not want all those example pages, etc. Just Bootstrap and the base layout to create my view's.
I have found everything I needed from a YouTube video, entitled "Plantilla Bootstrap en Proyecto ASP.NET MVC" (obviously in Spanish).
There are many steps:
Adding files to the project
setting the _Layout
set scripts references
bundles
Etc.
Ultimately, it worked.
step one
Create a MVC project Default template in visual studio
Step Two
Delete All cshtml in view folder expect shared folder
you must be detrmine wthich part of your page repeatly in all pages that is your layout and you can put html tag like header menu and footer in /views/shared/_layout.cshtml and write renderbody in part of layout to see default login homepage or etc
finaly
all css and java script folder paste in your project and in layout change target to available js and css resource
Learn about mvc Layout
Understand Css And JavaScript embed from bundle

MVC empty WebSite project based on aspx pages

In Visual Studio we have a two ways that create the web projects.
I create the "WebSite" project, empty-project (like: File -> New -> WebSite... and so on).
After that, when the WebSite created I want to make it to MVC WebSite with ASPX, and not Razor pages.
[I decide create the MVC WebSite not Project Site, with this way, because the Visual Studio doesn't provide us WebSite with MVC template based aspx pages].
After creating some pages I want to create and integrate any Razor page.
Describe for question:
IF I attempt use in the Razor view page - " #model MyWebSite " it does not discovering, and I can't use with the ViewBag property later
Question:
What Can I do ?
What NuGet packeg I need install or what dll recourse I need adding to Bin folder of project.
Yes, you can use Razor with an existing ASP.NET WebSite. Simply open your website using the WebMatrix tool and start adding CSHTML files. One caveat is that if your website is using WebForms controls the WebMatrix tool will not provide any help working with them in existing aspx pages. Additionally, Razor does not support WebForms so you will not be able to add something like to a CSHTML file.

MVC4 Areas Rendering Base _Layout Differently

I have an MVC4 application with two areas, "Reports" and "Admin". I want views in these areas to use the same _Layout that is used throughout the entire application (~/Shared/_Layout.cshtml). When I build the application and hit it on my dev workstation, both areas render correctly. However, when I publish it to Server 2008 R2 (running IIS 7.5), none of the views in the Admin area have the _Layout. I've switched browsers, tried both on the web server and hitting it from another system in the domain, clearing the cache....nothing has worked. Anyone know why this is happening?
In a current project I have an area and in this area's Views folder there's a file called _ViewStart.cshtml. Its Layout property points to the application level _Layout.cshtml file that's within the ApplicationName/Views/Shared folder.
_ViewStart.cshtml
#{
Layout = "~/Views/Shared/_Layout.cshtml";
}
Doing this you can share a common _Layout.cshtml file with all or only some of your Areas.
For more info about the _ViewStart.cshtml file be sure to check this answer:
https://stackoverflow.com/a/9300466/114029

integrating static html/css pages to an asp.net mvc project?

I am working for a personal project (Creating a website). I finished the design, then i converted all the pages to static html/css pages, after that i added some javascript. now I am with the final stage making the site dynamic i mean integrating the html/css pages to be an Asp.net MVC project with c# code that generates the content. even if i can tinker, but i prefer to be more methodical. so i am asking you for any guidelines how to do it ? and what the things i need to keep in mind to make this conversion ?
I am going to document my experience doing this here. It's going to be a incomplete and / or incorrect answer until I'm done with the process in a few days. I'm assuming Visual Studio 2012.
Create a new MVC 4 Internet Application project.
Add a method to the home controller for each static page.
Right click on each method and select Add View.
Open the images folder in VS and delete every item (from inside VS)
Drag all static site images into images project folder and add to project.
Replace contents of Site.css with static site css.
Paste the html from each page into the corresponding view. Leave the ViewBag.Title code block alone.
(still incomplete)

"Browse with..." option not available on ASP.Net MVC Project

I'm sure this is a simple misunderstanding but I'm trying to change the default browser in Visual Studio 2010 from Firefox (my machine's default) to IE so that VS will stop debugging when the window closes.
Based on ScottGu's post on the subject, I'm expecting a "Browse with..." option when I right-click on an aspx page in my MVC app; but there's no such option.
Also (possibly unrelated), when trying to launch the ASP.Net Configuration, the Cassini Development Server starts, but no browser instance launches. Starting to get very frustrated!
Asp.net MVC doesn't let you do this
You can only see "Browse with..." when you right click on the Default.aspx on app's root. Otherwise it's just not there.
This menu option obviously isn't stupid and doesn't let you browse a particular view, because it's not up to the browser to request a particular view, but up to a controller that may display some (or any) view... So Visual studio doesn't give you this option on your views.
I suppose it would be best if you've changed your default browser on your development machine.
In ASP.NET MVC 1 projects, you have to right click Default.aspx to get the "Browse with..." option.
However, ASP.NET MVC 2 projects do not have a Default.aspx. The best way to change your default browser is to create a standard ASP.NET project and set the default browser using that.
I'm building an MVC 2 project and encountered this issue. I just created a Default.aspx web form in the root folder, used the Browse With... menu it exposed to set my browser for this particular project to IE, then deleted the Default.aspx. Kind of a pain, but you only (should need to) do it once.
You can add an app_offline.html file to your MVC3 app. This is useful, because if you rename it to app_offline.htm and deploy it, it will cause IIS to deny all requests to the app (and will return the content of the app_offline.htm(l) file).
If you have one of these, you can right-click it to get the browse with option. In case you want to test out with different browsers & window sizes from VS, without a plugin.

Resources