I am running IIS 8 and I setup a quick URL redirect from a virtual folder. The url resembles something like home.cginet/applicaton/ and redirects to home.cginet/applicaton/tools/.
What happens randomly is when refreshing my page at the url home.cginet/applicaton/ sometimes it will come back with home.cginet/applicaton/tools/tools/tools/. In order to fix this I have to refresh 3-4 times for the page to kick in.
Just wondering is anyone has seen this type of behavior with their site?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="/Directory/staff/" exactDestination="false" childOnly="true" />
</system.webServer>
</configuration>
Related
With classic asp I try to redirect to a given page when server cannot find the requested page. However, I face strange extra-requests and responses when the first redirecting to the given page has taken place. For some reason there happens very many extra requests and responses to and from server.
Here is my simple web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false"/>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1"/>
<error statusCode="404" path="/folder/index.asp" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
</configuration>
Has anyone any idea why server continues with extra requests (some even 10 requests)?
Also, I noticed that css-file for the page takes no effect either. So, page html gets rendered without css-formation.
I also noticed that css gets rendered properly if target url has file-extension. But if url is extensionless, i.e. of the type "http://.../info/info2/222" then css does not get rendered even though 404-redirection happens (with very many extra requests / responses).
I noticed that your custom errors in the Asp application use httpErrors instead of customError. So the problem is probably because of this.
When the server cannot find the requested page, httpErrors will determine the responding page based on the statuscode. The path of the page is /folder/index.asp, and the response mode is ExecuteURL. So /folder/index.asp is actually another request and response.
You didn't mention the original css file reference method, but the page is rendered without CSS. So I guess the additional request may be for the CSS file. You can view it from the development mode of the browser.
I'm moving a site from one server to another. The original server is IIS. I need to redirect everything from www.old.com to www.new.com, EXCEPT one directory. I need www.old.com/folder1/folder2 to stay put and still be accessable. Anyone have any pointers?
This is what I'm using now, but the entire site gets redirected.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="http://www.new.com/" httpResponseStatus="Permanent" exactDestination="true" />
</system.webServer>
</configuration>
Thanks!
I need to add a location element in my web.config file, but the path starts with a dot (and I don't think I can change that path, it's for letsencrypt automation).
If I let the dot, like in <location path=".well-known/acme-challenge"></location>, the site doesn't start at all (I think the web.config file is not parsed at all because I get the page asking me to configure customErrors, but it is already configured and usually works fine)
If I remove the dot, like in <location path="well-known/acme-challenge"></location> the web.config file is correctly loaded, but of course that doesn't help me to configure anything at the location I wish.
The final goal is to disable basic authentication (which I need for the rest of the site) on this path only ; I don't even know if I'll be able to set this up in a <location> element.
I had a similar problem where I had a ASP.NET Forms site that was forcing authentication on all pages.
To expand on the accepted answer, here is the exact web.config I put in the /.well-known folder (NOT the /.well-known/acme-challenge folder):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<!-- This will stop any redirects you have at the higher level -->
<httpRedirect enabled="false" />
<!-- This will stop any integrated mode settings you have at the higher level -->
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<!-- This will allow unauthenticated users to acme-challenge subfolder -->
<location path="acme-challenge">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
</configuration>
After adding this file, I was able to use EcdsaAcmeNet to use Lets Encrypt with the site in IIS.
As suggested by Ondrej Svedjdar in comments, the solution is so simple I didn't think about it.
Just add another web.config file in the folder where you need it.
I want to create a default document called default and in that document I want it to rewrite the URL so instead of going www.bob.com it should instead go to www.bob.com/uv
Right now this is being done through URL rewrite rules, with patterns and all kinds of complications. I saw this done directly in the default document once, I cant remember if it was default.htm or .html or .aspx, using one line of code and I was very intrigued but I have not found it since then and no good examples have come up in my google searching. Does anyone have a link or could write the single line of code to add \uv to the url? Is there a really good example of it anywhere?
You can add which ever default page you want from IIS Manager -> -> Default Document - > Add (on right side) or by adding below in your web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="default.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
However this is a rewrite i.e. this will load default.aspx when you browse www.bob.com (URL remains same but the page is actually loaded).
If you want to actually change the URL (redirect) then with the same configuration above this below line in default.aspx
<%Response.Redirect("home.aspx")%>
How is it possible to change the script timeout on a windows azure website?
Given that you are not referring a specific language I assume it is ASP.NET. Either way, you have to change your web.config file and set the httpRuntime's executionTimeout attribute to a desired value in seconds:
<httpRuntime executionTimeout="300" />
If you are not coding in ASP.NET, just login to your web site with FTP, navigate to the site's root folder, open the web.config file and edit it. It must look something like (just a little more bloated):
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<httpRuntime executionTimeout="300" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
If there isn't file named web.config just create an XML file with the content above, name it web.config and place it in your site's root folder. That should do the trick for you.