Redirect web.config IIS 8 - asp.net

I tried to make a redirect in web.config, but I get a 500 error. The version of IIS is 8.5, but before I was on version 6. What is wrong with this syntax ?
<location path="Test/test.aspx">
<system.webServer>
<httpRedirect enabled="true" destination="http://domain/Test/IT/test.aspx" httpResponseStatus="Permanent" />
</system.webServer>
</location>
I get an this error message : Internal error - 500. I deleted the lines in web.config and everything works again.
I tried URL Rewrite feature, but I get an error.
"Cannot read configuration file due to insufficient permissions"
I am trying to fix with these instructions below, but the system asked me for user/password. I am as administrator, but those credentials didn't work.
Cannot read configuration file due to insufficient permissions
The HttpRedirectionModule is installed in the server. Also, RewriteModule

Did you install the HttpRedirect module? It is optional under IIS7+.
If that isn't it would help if you could post the detailed error message you get from hitting this locally if you can -- that will help narrow down the cause.
Finally, you might want to look into URL rewriting here, it is a new feature for IIS7+ that can handle simple url redirects like the above and much more.

Related

IIS error 500.19 error when reading web.config

I am running IIS under Windows Server 2016 and I'm trying to run an ASP.Net core 3.1 application but I can't get past this error:
500.19 error
(The language in the picture is Hungarian, but it contains no useful information whatsoever, just an example)
Here is my web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Minibizz.Routing.Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
What am I missing?
P.S.: The web.config was created by Visual Studio 2019.
The reason behind the issue:
That error message goes on to say what exactly is bad about your configuration file, hence you should refer the “Config Error” and “Config Source” sections. This problem occurs because of the ApplicationHost.config file or the Web.config file contains a malformed or unsupported XML element.
if you are using url rewrite rule then install url rewrite Extention of iis. Enable ANCM logging, ie. set stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout\" (I think the path needs to end by a backslash), then run the web app and see if something gets logged into the stdout folder. Verify that the log directory exists at the path referenced by the web config. If it does not, create it. The path shown in your config would place the "logs" directory in the root folder of the deployed site. Verify that the application pool has to write access to the logs directory.
Make sure you installed the .net bundle.check that you installed below iis feature:
You may also need to verify that the path to the dotnet executable exists in the deployment machine's environment variables. To check this, first find the path where dotnet.exe is installed. It is generally located in either C:\Program Files\dotnet or C:\Program Files (x86)\dotnet. Once you know the path, ensure that the path exists in your Environment Variables.
The web.config content seems to be correct. If you use a clean web.config copy, does the problem persist? If the issue can be solved by replacing web.config with clean configuration content, then the problem is exactly with this web.config. In this case, I suggest you remove parts of the web.config content to narrow down the issue. If the pages show correctly after you remove one section, then the problem is with that section. You need double-check what's wrong with the section and update the correct configuration.
If the problem remains even with clean web.config content, I suggest you access other pages in different folders in your site to see if the problem still exists.
you could refer this below link for how to publish asp.net core site in iis:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.1&tabs=visual-studio

Why do I get error 403 while trying to access apple-touch-icon.png over HTTPS but test in browser gives 200?

I have an apple-touch-icon.png in the root of my website in IIS 8.5, this is in the header:
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
In the web.config I give read access to this file:
<add name="AppleTouch" path="apple-touch-icon.png" verb="*" type="System.Web.StaticFileHandler" resourceType="File" requireAccess="Read" preCondition="integratedMode" />
When I test this in all browsers the icon shows up, but when I try to bookmark on an iPad I get the 403 error without a substatus.
Even when I check the favicons on https://realfavicongenerator.net/favicon_checker they work.
UPDATE1: using the "Failed Request Tracing Rules" in IIS I managed to get more info on the error. it shows this warning:
MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName
IsapiFilterModule
Notification
AUTHENTICATE_REQUEST
HttpStatus 403
HttpReason
Forbidden
HttpSubStatus 0
UPDATE2: thanks to more debugging of the IsapiFilterModule I found an issue with the .htaccess file. The apple-touch-icon.png was blocked by HackRepair.com Blacklist 2018 where CFNnetwork was blocked. Removing the RewriteCond for this HTTP_USER_AGENT gave no more 403 errors! The apple-touch-icon now works on iPhone, but not on iPad.
As far as I know, the 403.0 means user doesn't have the permission to access the file.I suggest you could follow below steps to modify the file's perission.
1,Right click the png file and click the property.
2.Click security and add iusr in the permission tab
3.Modify the IUSR permission to allow read and write.

Http Error 404:14 - Forbidden

I've installed my web application already in IIS. But when we run it, it contains HTTP Error 403.14 - Forbidden. I've researched about the solutions.
Enabled Directory Browsing.
-But enabling directory browsing is not allowed.
Add Defalut Document
-I already have a default Document.
So now, I'm practically lost on how to solve this issue.
Have you already registered the framework for iis in the computer?
C:\windows\Microsoft.NET\Framework64\v4.0.30319> .\aspnet_regiis.exe -ir C:\windows\Microsoft.NET\Framework64\v4.0.30319> iisreset
run that in command prompt
Note: Path will of course change depending on your local drive
I've already solved this issue. There's just something wrong with my default document in my web.config. I used ~/Login.aspx instead of Login.aspx.
<defaultDocument enabled="true">
<files>
<clear />
<add value="Login.aspx" />
</files>
</defaultDocument>

"Could not load type" error trying to install HTTPModule on IIS6 - Web.config error

Two hours of searching Google and Stackoverflow and I've gotten nowhere. This is not related to code-behind, which is why I've had no luck so far.
Here's my problem: I have a legacy website running IIS6 and I need to install an HTTPModule on it to add some processing to any request for a specific file type. I've written the module, copied it over to the application's /bin directory, and added the following to my Web.config:
<system.web>
<httpModules>
<add name="YourModule" type="SecurityModule.SecurityModule" />
</httpModules>
</system.web>
Then I fire up the website and... "Server Error in /MyApplication".
Here is the entirety of what it gives me:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load type 'SecurityModule.SecurityModule'. (D:\Websites\Reports\web.config line 4)
Source Error:
Line 2: <system.web>
Line 3: <httpModules>
-->Line 4: <add name="YourModule" type="SecurityModule.SecurityModule" />
Line 5: </httpModules>
Line 6: </system.web>
Source File: D:\Websites\Reports\web.config Line: 4
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3618
Line 4, where I added an arrow, is red. And that's it! No explanation, no hints on where to go. Just "Could not load type". I have tried all sorts of things to get around this:
Played with the name of the module in case I got it wrong. And the string in the type.
Changed /Bin to /bin
Make sure the module was compiled against the .NET Framework 2.0
Abandoned web.config and tried setting it up as a mapping in IIS 6 (got 404s from that one).
Related to previous, tried making all files of my extension go through the ASP.NET ISAPI module with a wildcard mapping and configuring the module. Brought me full circle back to this error.
Can anyone tell me what's going on here? Or, failing that, can someone point me in a direction? At this point, any direction will do. :) I'm at a complete dead end.
Thanks!
You should use an assembly qualified name.
NamespaceQualifiedTypeName, AssemblyName

make permission in IIS7

I have IIS7, web app is written on ASP.NET 1.1.
I need to see files and folders in the browser when adress as like http://localhost/MyProject.
Have to make permission for this? or...
so, help me please
UPD. Yes I know it. But when I did this I have this error
Line 215: </root>
Line 216: </log4net>
Line 217: <system.webServer>
Line 218: <directoryBrowse enabled="false" />
Line 219: </system.webServer>
After That(I read about this pronlrm on interner http://blogs.iis.net/bills/archive/2008/06/02/installing-asp-net-1-1-with-iis7-on-vista-and-windows-2008.aspx)
I have added to (%windir%\Microsoft.NET\Framework\v1.1.4322\config\machine.config)
this .
And the error gone.But I still can not browse files.
From IIS click on your website. Under IIS go to Directory Browsing and click Enable. See a more complete description on MSDN.

Resources