I have this site but the css files do not seem to load correctly :http://185.58.193.198:12500/HelpDesk/
Can some tell me what changes i should make. I have used wamp for the database and IIS for hosting
There many reasons for 403 error, you can try to add below code in your web.config file:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
</customHeaders>
</httpProtocol>
</system.webServer>
and you can also try enabled anonymous authentication in iis authentication.
Related
I need to use IIS only for directory browsing. The directory contains ASP.NET Core files and IIS automatically attempts to serve them normally.
Is there a way to force IIS to display all files as static files?
In order to let IIS serves everything as static content, you have to
Keep only Static Files handlers
enable directory browsing
Add mime type for every file. Without that IIS won't know how to serve unknown file type
Disable request filtering to download .config file, bin folder content, etc.
You will find below the corresponding web.config
WARNING : big security issue. Be sure to understand the risk before applying this configuration
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add name="StaticFiles" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
<directoryBrowse enabled="true" />
<staticContent>
<mimeMap fileExtension=".*" mimeType="application/octet-stream" />
</staticContent>
<security>
<requestFiltering>
<hiddenSegments>
<clear />
</hiddenSegments>
<fileExtensions>
<clear />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
</configuration>
Hosted Angular 2 project in IIS 8.5 server. And I want to use my Asp.net project in same port like child application. So, I have created an application under my angular website and pointed it to Asp.net application folder, I gave permissions too.
http://localhost/api (api is alias name for Asp.net project) but not able to accss http://localhost/api/mycontroller/method.
In Asp.net webconfig what are the changed I have to do?
Added inheritInChildApplications in config file,but no use
<location path="." inheritInChildApplications="false">
<system.web>
In angular web.config
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type, Authorization, X-Requested-With" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
</customHeaders>
</httpProtocol>
and in Asp.net webconfig
<location path="." inheritInChildApplications="false"><system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept, Authorization,*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
</customHeaders>
</httpProtocol>
So am getting Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'Access-Control-Allow-Origin' error.
I am trying to implement the advice from Google's Pagespeed concerning browser caching(Set Expirer or Cache-control headers on static content).
After reading many posts here (like IIS7 Cache-Control ) and on other website I just can't seem to figure out why Pagespeed is for example still disapproving my CSS files.
For example: http://test.grotefeesten.nl/clientdata/71/js/jssor.config.js. This file has an expiration time of 1 day according to local PageSpeed but not according to the online PageSpeed test.
My web.config:
<caching>
<profiles>
<add extension=".css" policy="CacheUntilChange"
kernelCachePolicy="CacheUntilChange" location="Any" />
</profiles>
</caching>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="public" />
</customHeaders>
</httpProtocol>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlCustom="max-age"
cacheControlMaxAge="1.00:00:00" />
</staticContent>
Does anybody see what I am missing here to set the Expires header properly?
I had been struggling with this myself. However, I found a solution:
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="max-age=2592000" />
</customHeaders>
</httpProtocol>
This was all it took. The value in the code above, "max-age=2592000", is 1 month.
I am trying to neatly disable output caching for WCF application. enableOutputCache attribute does not work for some reason, can someone explain the reason, or suggest a work around.
<system.web>
<caching>
<outputCache enableOutputCache="false" enableFragmentCache="false"></outputCache>
<outputCacheSettings>
<outputCacheProfiles>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
Thanks
I know this is an old question but I'd like to give my two cents. I actually needed to disable caching of webapi services that are called by a SPA, and on some versions of IE they where cached by default unless the cache-control:no-cache and similar headers where present. What I did to enable browser caching of static resources and disable it for all the services was add the headers depending on the location using the web-config.
i.e.
<location path="api">
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache" />
<add name="Expires" value="-1" />
<add name="Pragma" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
Environment: IIS 7, .Net 4.0
In web.config of our application, it has this section:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="cache-control" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
Most of our application requires no-cache, but there is only one page that requires cache-control to be Private. Is a way to do it?
Appreciated for any input
You cannot apply or override settings from web.config to a particular page, however you can do this for all pages inside a folder, by following settings.
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="cache-control" />
<add name="cache-control" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
However, you can override the cache-control settings in Page_Load event of a particular page.
Response.CacheControl = "Private";
You can also change response caching for a page by setting the location attribute of #outputcache directive.
<%# OutputCache Location="Server" %>