Issue with videos in a deployed web in AZURE - html

I'm having a problem with a deployed webapp service in AZURE, the videos contained in the web page are not working.
The message is the next one:
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
The HTML code is the next one:
<i class="icon-play2"></i>
Can anyone help me please?
Thanks!

As #Offbeatmammal mentioned, we need to configure the MIME types in web config file before we use the specific file type in our web application. Since your video type is mp4, you need to add following configuration into < system.webServer > tag.
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>

Yes thank you! Solved with a web.config file!
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4"/>
<mimeMap fileExtension=".ogv" mimeType="video/ogg"/>
<mimeMap fileExtension=".webm" mimeType="video/webm"/>
</staticContent>
</system.webServer>

Related

Block direct access to mp4 videos while allowing them from viewing within the website using web.config

I am trying to block (using web.config) direct access to mp4 videos while allowing videos to be played within the website:
Here's my current web.config's content. This blocks videos to be played on my HTML page as well as direct access.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".mp4" allowed="false" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
</configuration>
How can I allow video to be played on HTML while blocking direct access?
You can put your “Uploads” folder outside the website directory, so if your website exists on “c:\website” you can put the “Uploads” there “c:\Uploads”, Like that IIS has no control over this folder and its files, And your website code will still have access to this directory as a normal physical path.
or you could try to set the hidden segment in web.config file:
<configuration>
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments>
<add segment="Uploads" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>

Working with dotnet and angular2

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>

Azure custom 404 page

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>

json mime-type on 2003 server issue

Here is my issue:
I have a solution working on a 2003 server with iis 6
And every time I deploy the solution I have to configure the MIME type on the iis.
I have implemented this in my web.config, but it doesn't seem to work properly.
<staticContent>
<remove
fileExtension=".json" />
<mimeMap
fileExtension=".json"
mimeType="application/json" />
</staticContent>
Is there a global way of setting this up?
I think I found a solution to the problem, add this code on top of the other and it worked.
<system.web>
<staticContent>
<remove
fileExtension=".json" />
<mimeMap
fileExtension=".json"
mimeType="application/json" />
</staticContent>
</system.web>
The issue was that the <system.webserver> not allways works on 2003 server, therfore the <system.web> was needed also.

mimeMap still does not display my svg

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