I have recently integrated a boostrap admin template (based on Angular2) in an asp project (here is the repo)
The thing is: when I am running tsc, all files compile well, but if I change html files, if the web browser (let say firefox) opened the project previously, the page never change, but if I open a new web browser (let say chrome) I can see the change. Now, if I change an html again, neither one can detect new changes in html files.
I think it is dotnet configuration, because I used the bootstrap angular template which is set up with npm lite server, and it has not any problems (I mean: change .ts files, .html files and it refresh always well)
To reproduce the problem, these are the steps:
npm install
dotnet restore
dotnet run
go to /pages/login <- It displays everything ok
edit login.component.ts: template: <h1> Hello!</h1>
go to /pages/login <- It keeps showing the login form
go to /pages/login (google-chrome) <- It shows the change
edit login.component.ts: template: <h1> Hello World!</h1>
go to /pages/login (google-chrome) <- It only shows Hello!
The asp app were caching the pages, so I changed the web.config
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache, no-store" />
<add name="Pragma" value="no-cache" />
<add name="Expires" value="-1" />
</customHeaders>
</httpProtocol>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
Related
I have created a web application using Microsoft Azure and uploaded static html pages to the web application.
It works fine, however, I would like to set a custom 404 page. Where or how can I do this using the Azure portal ?
Just to be clear, this is not a visual studio project, it's just some static html files. I just want to tell azure to use my 404 page instead of the default text it displays when a page cannot be found.
EDIT
Please note, this has nothing to do with IIS. I dont even have a web.config file. I am simply hosting some static html files in Azure and want a custom 404 page. I have already made the 404.html page.
Seems like you have to add a web.config file in your root directory. This seems like a workaround, but doing that and adding the following code works:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/404.asp" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
Follow these steps to configure a custom 404 page for a Azure Static Web App:
Create a file named staticwebapp.config.json in root page (same folder as starting page i.e. index.html)
put these lines inside it:
{
"responseOverrides": {
"404": {
"rewrite": "/404.html"
}
}
}
Put your custom 404 page in root or subfolder (in this example 404.html is in root folder)
After a lot of testing and research, it was found that using responseMode="ExecuteURL" would result in a correct redirect, but the browser would report 200 Status rather than a 404. To fix this we removed the "/" and changed to responseMode="File" based on insight from this post: web.config errors fail with responseMode="File"
We are just hosting a simple static HTML site, not a web app, and this code worked:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors defaultRedirect="404.html" mode="RemoteOnly">
<error statusCode="404" redirect="404.html" />
<error statusCode="500" redirect="500.html" />
</customErrors>
</system.web>
<system.webServer>
<httpErrors existingResponse="Replace" defaultResponseMode="File" errorMode="Custom">
<remove statusCode="404" />
<error statusCode="404" path="404.html" responseMode="File" />
<remove statusCode="500" />
<error statusCode="500" path="500.html" responseMode="File" />
</httpErrors>
</system.webServer>
</configuration>
I've got an issue with VS2015 and razor syntax highlighting.
I'm not using System.Web.Mvc or System.Web.WebPages, just System.Web.Razor directly to render some HTML.
In web web.config I have the below, which worked fine in VS2013:
<system.web.webPages.razor>
<pages pageBaseType="MyProj, RazorView" >
<namespaces>
<add namespace="System"/>
</namespaces>
</pages>
</system.web.webPages.razor>
none of the namespaces are being imported by VS, so everything is red and squiggly.
I've tried the /ResetUserData trick from the RC, but to no avail. What can I try next?
I'm trying to develop a website that uses features not compatible with IE7/8, but the company-standard browser (IE11) we all use forces my page to use Enterprise Mode (which is effectively rendering with IE7/8).
Everything I've seen talks about fixing it on a high-level "site list" within the company, or making a browser not use Enterprise Mode locally (by modifying registry entries). One internally suggested approach was to use the meta tag:
<meta http-equiv="X-UA-Compatible" content="IE=11" />
...but it didn't work.
Is there any way I can force the client, from the server-side, to not use Enterprise mode?
Note: We are using Websphere 8.5 servers.
This has worked for me - forcing the X-UA compatible header from IIS by modifying the application's web.config file as below (if you are using IIS as your webserver).
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-UA-Compatible" /> <!-- in case it was already set -->
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
I have a new MVC 5 Project and I am trying to get FontAwesome to display icons from the _Layout page. It works fine in Chrome, Firefox, and even the Page Inspector in Visual Studio. When I launch the site in IE 11, it just shows a blank space.
What I've tried so far:
Making sure the font-awesome.css and fonts are being downloaded to the browser
Checking the paths to the directory where the fonts exists is correct
Loading from the BundleConfig and just putting the links directly on the Layout page
Installing FontAwesome using Nuget and tried an Nuget Html Helper for FontAwesome
Tried added MIME types for the fonts to the web.config
Tried using CDNs and Fully qualified paths instead of relative links
Tried several variations of the markup
Validated no errors in the Console or 404s in the Network Debugger
I'm not sure what else I can try and feel like I've spent WAAAY to much time just trying to get some icons to work. It's just frustrating because the site looks really good in Chrome and Firefox.
I am using a Template I downloaded from WrapBootstrap, but their examples work in IE 11, and I've tried to mimick their markup as best I can.
Below is the markup in the Layout page I am using and this comes directly from their Template and it works in FF/Chrome.
<i class="icon-dashboard"></i>
and I tried
<i class="fa fa-dashboard"></i>
Any guidance on troubleshooting would be appreciated.
It's not really that complicated. If it works in Chrome and Firefox it will work in IE11. My guess is that you've either switched the rendering engine to IE7 at some point and forgot, accidentally clicked the compatibility mode button (which renders as IE7), or otherwise are working in compatibility mode (depending on your local or GP settings, if this is a work machine, compatibility mode may be the default for local and/or intranet sites).
I just had this issue but found that it was actually caused by the fact the font files reside on a different subdomain. Adding an Access-Control-Allow-Origin header when serving the fonts solves the problem.
Apache .htaccess snippet
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
nginx virtual host file snippet
location ~* \.(eot|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
More information can be found here (original source for snippets).
Another possibility (which I just spend 4 hours debugging) is that IE-11 is falling back to an older document compatibility mode without your knowledge. The thing to do is make sure the auto-detected target really reads "Edge". In my case it was blank.
The files were downloading.
The MIME types and headers were right.
My document had the right compatibility meta tag set.
I could surf just fine.
The console showed no JS errors (or errors of any kind).
Yet still no Fontawesome.
Turns out if your HD is running low on space as my VM was and the available temp cache falls below a certain size, IE silently reverts to showing all websites in compatibility mode (no matter what your settings are in regard to when to use compatibility mode).
Try this in your web.config. It should work for Font-awesome 4.7:
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<remove fileExtension=".otf" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
<mimeMap fileExtension=".otf" mimeType="application/font-sfnt" />
</staticContent>
</system.webServer>
I am sorry if it is something novice or silly but this is my first time using a web.config file.
I have been dealing with the pleasure of godaddy not provide svg support by default. So I found some info on using a web.config file to inform the browser what to do with this file type.
Sources
Link 1
Link 2
Link 3
I am able to get the file in the server without crashing everything. The website will still display instead of displaying a 500 (internal) error but the svg still does nothing.
Here is my web.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="images/svg+xml" />
<remove fileExtension=".svgz" />
<mimeMap fileExtension=".svgz" mimeType="images/svg+xml" />
</staticContent>
</system.webServer>
</configuration>
Does anyone know what I am doing wrong? I also put the file into the main root file on the server but no luck.
Live site if it helps: Mobile app design
It appears your mimeType is incorrect. Remove the "s" from the images:
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
reference, if you like documentation