Css is not loading in MVC4 razor layout - c#

I have added the CSS in the _Layout but it is not loading the CSS or any Javascript Files
I have folder structure like this
Assets/Css/admin/... so on
In my MVC4 razor layout I am loading the css like this rather using Bundles
<link rel="stylesheet" href="#Url.Content("~/Assets/css/admin/module.admin.stylesheet-complete.min.css")" />
but its not loading the css according to this pattern. I used the same in MVC3 razor layout and it worked.
After loading clicking the url generated in rendered form in browser it shows
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IIS 8.0 Detailed Error - 500.0 - Internal Server Error</title>
Contents of my Css File
#import '../../../Assets/components/common/forms/editors/wysihtml5/Assets/lib/css/bootstrap-wysihtml5-0.0.2.css';
What seems to be the problem with MVC4 ?
Please guide

Thanx all I have figured it out. I have changed the project setting to Annonymous Authentication to Enabled and Windows Authentication to Disabled. The problem is solved by doing this. Thank you for your efforts

Related

Why are most of my CSS files not loading when using an ASP.NET Core app

Only some of my styles are loading and I'm not sure why. The stylesheet must work if some of my styling is working, but why aren't all of them loading? I am using ASP.NET Core 3.1.
I have the following in every HTML file I will be using.
<link rel="stylesheet" href="~/css/style.css">
I don't think that it's the file path because some of the styles show, just not all.
I figured it out. Sometimes you have to do a shift + reload to update the css styles.

Setting .NET Website on IIS Server in Windows Server 2016 Environment

ImageI am setting up my web application (working) in the Windows Server 2016 Environment which has the IIS role set up. My application outputs the following error when I try to run it: "The page you are requesting cannot be served because of the extension configuration" error.
I have a simple application that has a label and needs to change the text of label on Page Load. My .aspx files work if I don't mention the CodeBehind file .aspx.cs file .
I believe this is a case of .aspx.cs file access. I have a much bigger application and I made this small one for asking this question. My guess is that I cannot access my .aspx.cs file.
I have tried adding "allow fileExtensions=".cs" ....." and this add cs to the list of allowed files. I have also tried using the aspnet_regiis -i to install asp.net which worked correctly.
As for my setup, I have added the IIS role, installed the ASP.NET 4.5 and its Extensible feature and also ASP.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Intro.aspx.cs" Inherits="Intro" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<asp:Label . ...../>
</body>
</html>
UPDATE :Thank you all for your responses. This stackoverflow community is great . As for the solution I enabled .NET 3.5 features , .net 4.5 features, and all features related to a Web Server . A more concrete answer would help but this worked for me. Thank you all .
Web.config

How to add a CSS style sheet reference to all Web forms in a Visual C# .NET Web project

i tried to link a css style sheet but it didnt worked.
I tried
<link type="text/css" rel="stylesheet" media="all" href="~/Content/event.css" />
I have a folder content , in which i added the css files.
what it is wrong ?
It was missing runat="server" in the head balise .
You can have a layout page and define any public file that you need in all parts of your project as .js or .css file. Then you can use this layout in your pages. as below:
#{Layout="Layout.cshtml";}
Your question is not clear. Maybe this page can help you in using layout pages. (Also pay attention to sidebar of the page, too)

MVC5 jquery datatables

I have a simple problem which I am unable to solve.
I just started my new .NET MVC5 project in Visual Studio 2015 and I wish to use jquery DataTables.
I used NuGet to install jquery.datatables by Allan Jardine.
Now that I did that, i see those datatables in references, but not in wwwroot folder.
In my wwwroot folder I have bootstrap which works fine.
I used the same thing in MVC4, but there are Script folders and Bundles, which don't exist in MVC5.
How can I use my installed DataTables?
References picture
wwwroot picture
My script.js is like this:
alert('a');
$('#prvi').DataTable();
And alert is triggered, but on console view in Chrome, .DataTable() is shown as invalid.
In my _Layout.cshtml I'm referencing to:
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
I am completely new to MVC5 so I guess this is really trivial issue.
Still, I'd really appreciate your help.
While you don't give any further details about your code, perhaps it's a simple typo. the DataTables initializer is actually camelCase. so try:
$('#prvi').dataTable();
Lowercase "d"

Regarding Telerik Reporting

I created this class library(ReportLib) with a simple Telerik report using Telerik Reporting Wizard. I then made this simple web application project, added ReportLib as a reference. Now in my asp page, intellisense is not detecting Telerik:ReportViewer tag! In the code behind too I have added the following ;-
using Telerik.Reporting;
using Telerik.ReportViewer;
What's wrong ? My web app project is building successfully. Why won't it detect the telerik tags?
[EDIT]
Do i need to register the Telerik.Reporting.dll on my aspx page too? How to do that ?
Registered assembly as follows..still wont detect the telerik:report viewer tag:-
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplicationReporting1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%# Register Assembly="Telerik.Reporting" Namespace="Telerik.Reporting" TagPrefix="telerik" %>
<%# Register Assembly="Telerik.ReportViewer" Namespace="Telerik.ReportViewer" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<tel
</div>
</form>
</body>
</html>
[EDIT]
ok in my web config file..there's no telerik assebly added that I can see..How so ? I did add the refernce to telerik reporting dll! Why didnt it show up in web config file?
Check the Telerik Reporting documentation about your problem. First, you will need to create your report within a class library project, and then assign the report to the Web Report Viewer.
In case you still have problems, contact Telerik - they will assist you with a more detailed reply.
Your project most likely, does not have the correct reference to the correct Telerik assmbly. The contractors we sometimes hire where I work, run into this and 100% of the time thats been the issue.
If you dont know how to register the control then go into the design mode for your page and drag it from the toolbar, and drop it into your page. VS will write the code for you.
The drag-and-drop solution will also take care of your web.config settings

Categories