css and images are not loaded on IIS - css

This is my web config
<configuration>
<connectionStrings>
<add name="vmpcon" connectionString="data source=localhost;Database=XXXX;User ID=XXXX;Password=XXXX; Trusted_Connection=False;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
I have one page on that site, and when I navigate to it, I got just the html without any css affects and without the images.
I tried using chrome to check if there is any error on console but there is no error on console
I choose integrated on IIS, but If i choose classic, the page becomes empty.
help me to load the css and images please?
if you need more information tell me please
IIS 6.1
Update 1
In chrome, I see that the type of the css file is text/plain though I declare it like this:
<head runat="server">
<title>YMC Popup</title>
<link rel="stylesheet" href="css/style.css"/>
</head>

Enabling static content via server manager was the solution

Related

Windows Authentication in local system

This is the default.aspx file
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"Inherits="Default"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Welcome to sample website:)
</div>
</form>
</body>
</html>
This is the web.config file
<?xml version="1.0"?>
<configuration>
<system.web>
<authentication mode="Windows"/>
<identity impersonate="true"/>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
I am unable to get the windows authentication , I did the required changes in the applicationhost.config file as well.Kindly help me how to proceed ahead.
Your web.config configuration is incomplete.
See: Enabling Windows Authentication within an Intranet ASP.NET Web application
There's also plenty other guides/blog posts on setting up Windows Authentication for asp.net if you just search the internet.
You haven't told ASP.NET to deny anonymous users, which is why you don't get the login prompt.
<configuration>
<system.web>
<authentication mode="Windows" />
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>
Note that the directive within the
section above is what tells ASP.NET to deny access to the application
to all “anonymous” users to the site (the “?” character means
anonymous user). This forces Windows to authenticate the user, and
ensures that the username is always available from code on the server.

ASP.NET : Error 500 instead of Detailed Error

All of a sudden i am getting a error 500 on my Asp.Net web application hosted on smarterasp.
I can access the pages but cant access any of the resources (CSS,JS,Images etc)
Here is a CSS File.
The Error : The page cannot be displayed because an internal server
error has occurred.
Even if you try accessing a resource that does not exist, it should through a 404 but instead, you will get a 500. I tried contacting the support and they said everything is fine on their end.
I already have set customErrors=off.
<system.web>
<trace enabled="false" />
<customErrors mode="Off">
</customErrors>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime requestValidationMode="2.0" />
<pages controlRenderingCompatibilityVersion="4.0" />
</system.web>
I had defined mimeMap for static contents which was working fine before in web.config but then found out StaticFileModule was already installed on the web server which was causing the problem.
(Probably they recently installed it)

ASP.Net Does NOT accept <appsettings> tag

I am new to ASP.NET. I added following code to solve Validation Controls problem:
<appsettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms">
</add></appsettings>
But creating new bugs with adding this. Getting Error "HTTP Error 500.19" with this information:
The requested page cannot be accessed because the related configuration data for the page is invalid.
The configuration section 'appsettings' cannot be read because it is missing a section declaration.
Error Code: 0x80070032
My web.config content is simply this:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<appsettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms">
</add></appsettings>
</configuration>
I searched the web and didn't find a specific solution for this issue. And as I saw in related articles such errors may have many reasons. I don't know which one causing mine.
XML is case sensitive. You are looking for <appSettings>, not <appsettings>:
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" />
</appSettings>
You can make the add element self-closing, but that is just a little nice syntactic sugar that isn't required.
More documentation about the appSettings element can be found on MSDN.
Your add tag should be self-terminating, but as vcsjones points out, your issue is likely case sensitivity of <appSettings> (not <appsettings>)
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms"/>
</appSettings>

The element 'system.web' has invalid child element 'defaultDocument'

I'm training my web.config to recognize what the best default file is. According to my host it's supposed to look like in the listing below.
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings/>
<system.web>
<defaultDocument>
<files>
<clear />
<add value="Defalut.aspx" />
</files>
</defaultDocument>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<pages controlRenderingCompatibilityVersion="4.0"/>
<machineKey/>
<customErrors defaultRedirect="Error.aspx" mode="On"/>
</system.web>
</configuration>
The problem is that VS2012 (Express) marks it blue and claims the error in the subject. First i thought that i could upload it as it is and by brute force make the server to like the file but it then got angry and spat out the following
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
As i read the error message it says that: "The configuration section 'defaultDocument' cannot be read because it is missing a section declaration."
I've done my homework and found the article below but due to the limitation in my situation (e.g. i need to manually upload the web.config file and i can't run any scripts on the server of my hosting company), it was to no avail.
How do i kill this little problem?
"Defalut.aspx" is a definite yellow flag.
SUGGESTION:
Just create a new dummy project with MSVS2012 (I don't have a copy handy, so I can't help you at the moment)
Cut and paste the auto-generated "web.config" into your project and verify that it works.
If it doesn't, make ONLY those MINIMAL changes needed to get a clean compile/execute.
Save a backup of your working web.config
Try adding your "defaultDocument" section and see what happens.
If it still doesn't work, please cut/paste:
a) the exact section (as I presume you did above)
b) the exact error message
ALSO:
Q: It now fails in BOTH your MSVS2012 (running locally) AND your target web server, correct?
Q: Are you sure the target web server is ASP.Net 4.0 capable?
You config looks correct but the error occurs because it cannot find the file that is mean to be the default document for all your website folders
So please replace "Defalut.aspx" with he correct spelling of the file in the below xml
<defaultDocument>
<files>
<clear />
<add value=*"Defalut.aspx"* />
</files>
</defaultDocument>
Late to the party, I know, but for anybody still with a similar problem, I don't believe this has anything to do with the spelling of the default page name (that will probably just give a 404 when it's accessed).
The real issue is that the defaultDocument section should actually be under system.webServer, not system.web. See defaultDocument Element for more info.
So your sample config file should look something like:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings/>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<pages controlRenderingCompatibilityVersion="4.0"/>
<machineKey/>
<customErrors defaultRedirect="Error.aspx" mode="On"/>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Defalut.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

Unable to get dotLess to work

I am using dotLess.
I followed all their instructions (which seems simple enough) it's only 4 steps :)
my minimal web.config looks like this:
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler,dotless.Core" />
</configSections>
<dotless minifyCss="false" cache="true" />
<system.web>
<httpHandlers>
<add type="dotless.Core.LessCssHttpHandler, dotless.Core" validate="false" path="*.LESS" verb="*" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="LessHttpHandler" type="dotless.Core.LessCssHttpHandler, dotless.Core" preCondition="integratedMode" path="*.less" verb="*" />
</handlers>
</system.webServer>
</configuration>
I've added my .less files in my content folder (i am using ASP.NET MVC - Razor ViewEngine)
my layout has a link to my .less include file:
<link rel="stylesheet/css" type="text/css" href="#Url.Content("~/Content/Site.less")" />
I have also added the a reference in my web application to dotless.Core.dll
Yet despite all of the when i do a simple styling of the page's body backround to black, nothing happens, for some reason it aint kicking in.
Am i missing something here?
Do you set the httphandler to run on requests? Add this:
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>
</system.webServer>
</configuration>
have you tried accessing the Site.less file directly with your browser? If there is a syntax error in your less it will be output there..
If you get a 404 on that page the web.config is the problem, but I can't find anything wrong with it at the moment.
Are you running in Cassini or are you running on IIS7?
I'm not sure if this may be the cause, but in your link tag, rel value should be "stylesheet", not "stylesheet/css".
Also, I don't use ASP MVC but don't you need a tag around the Url.Content, like so?
<%= Url.Content("~/Content/Site.less") %>
Have you tried setting the cache to false? On some machines I've had issues with it.

Resources