How to increase the IIS response chunk size - iis

We are migrating our sharepoint 2003 to espace. Though users are informed about the migration, some users are still using the old links. This could be because they have saved the old urls in Favourite sites and trying the same. So we thought of developing ISAPI dll, with which we can catch the 404 File Not found or "Site not in content DB" error and redirect the user to correct site.
So I developed one ISAPI dll in Visual C++. To redirect the user I am modifying the location to new url and set the HTTP status to HTTP 302 Redirect. But one challenge I am facing here is, IIS sends response in chunks and "site not in content DB" error text comes as part of the second chunk. By the time first chunk with header info, including status and location will be passed and I will not be able to modify further.
Is there any way I can increase the size of the IIS response chunks?

I tried -
Stsadm.exe ?o setproperty ?pn large?file?chunk?size ?pv <size in bytes> to increase the chunk size.
It works!!

Related

IIS 10 - HTTP Error 413.1 - Request Entity Too Large

I am having an issue posting a large file using IIS 10 and .Net.
The error code i receive is from IIS:
HTTP Error 413.1 - Request Entity Too Large
The request filtering module is configured to deny a request that exceeds the request content length.
I found many solutions online that are not working. Here are the changes i have made to IIS.
These changes were done under the default website which hosts the application where i'm having this issue. The changes made to the default website have propagated to all the sites contained within.
I have also set the uploadReadAheadSize to 2147483647:
The file i am attempting to upload is 97 MB.
What am i missing?
Set the uploadReadAheadSize value in the configuration file, here are the steps:
Select the site under Default Web Site
Select Configuration Editor
Within Section Dropdown, select "system.webServer/serverRuntime"
Enter a higher value for "uploadReadAheadSize" such as 1048576
bytes. Default is 49152 bytes.

Understanding a 404 error in IIS

I have a classic asp web application in which I've created a custom friendly 404 page. Also within that page, I have logic to email me the 404 info so I can check it out as to why it happened.
One of the pieces of info I email to myself is
Request.ServerVariables("HTTP_REFERER")
As I understand it, it should tell me the origin of the 404, ie. the page which is making the request to the file that doesn't exist.
However, I get notifications where the Referer is referencing a page in my site that doesn't exist in the first place. How can this be? Am I pulling the wrong ServerVariable? Is someone trying to do some cross site scripting?

Why is IIS giving 403 with single quote in URL?

I have an ASP.NET (version 4) MVC 3 application running on IIS 7.5. Anytime there is a single quote in the URL, for example http://devserver.com/myapplication/Home?filter=id~eq~'123' - I get a 403 Forbidden error.
Specifically, this happens when I'm using a Kendo UI grid and am trying to filter one of the columns. But I found that anytime a single quote is in the URL, IIS immediately gives the 403 error.
I've looked in the IIS logs and the event viewer and there is no indication anywhere of a 403 response - I can't seem to find out specifically why the 403 was given.
It's not IIS, it's Siteminder! We have Siteminder in front of our web application, and Siteminder intercepts all incoming traffic for authentication. In this case, Siteminder will also disallow a URL with a single quote in it. Although the 403 error looks like it's coming from IIS, it's really coming from Siteminder.
This issue happened for my app as well and the culprit is Siteminder in my case.
They have a set of BadCSSChars lists which would be validated against our URL. If any bad character is found, the URL will be blocked and wont reach IIS.
Siteminder can remove the 'character needed' exception in the agent.log file (not an expert in this, but heard that this file which stores badcsschars list) in the app server.

How to move pages around and rename them while not breaking incoming links from external sites that still use the poorly formed URLs

update
Here is the situation:
I'm working on a website that has no physical folder structure. Nothing had been planned or controlled and there were about 4 consecutive webmasters.
Here is an example of an especially ugly directory
\new\new\pasite-new.asp
most pages are stored in a folder with the same name as the file, for maximum redundancy.
\New\10cap\pasite-10cap.asp
\QL\Address\PAsite-Address.asp
each of these [page directories]? (I don't know what else to call them) has an include folder, the include folder contains the same *.inc files in every case, just copied about 162 times for each page directory. The include folder was duplicated so that the
<!--#include file="urlstring"--> would work correctly due to lack of understanding of relative paths, and the #inclue virtual directive or using server.execute()
Here is a picture if my explanation was lacking.
Here are some of my limitations:
The site is written in ASP classic
Server is Windows Server 2003 R2 SP2 , IIS 6 (According to my resource)
I have no access to the IIS server
I would have to go through a process to add any modules or features to iis
What changes can I make that would allow me to move pages around and rename them while not breaking incoming links from external sites that still use the poorly formed URLs?
To make my question more specific.
How can I move the file 10cap.asp from \new\10cap\ to a better location like \ and rename the file to someting like saveourhomescap.asp and not break any incoming links and finally, not have to leave a dummy 10cap.asp page in the original location with a redirect to the new page.
Wow, that's a lot of limitations to deal with.
Can you setup a custom error page? If so you can add some code into a custom error page that would redirect users to the new page. So maybe you create a custom 404 page, and in that page you grab the query string variable and based on that send the user to the correct "new" page. That would allow you to delete all of the old pages.
Here is a pretty good article on this method: URL Rewriting for Classic ASP
Well, you have a lot of limitations and especially no access to the IIS server hurts. An ISAPI module for URL rewriting is not an option here (IIS) and equally a custom 404 page where you could read the referer and forward with a HTTP 301 won't work (IIS).
I would actually recommend you to go through the process and let them install:
An ISAPI URL rewriting module
or if that doesn't work (for any reason):
Let them point the HTTP 404 of your web to a custom 404.asp, read the referer and redirect with a HTTP 301 (Moved Permanently) to your new location.
If none of this is an option for you, I can think about another possibility. I haven't actually tried that so I'm not 100% sure if it will work, but in theory it sounds good ;)
You could make in your global.asa in the Session_OnStart event a Response.Redirect or change the header of your response to a HTTP 301. This will actually only work for new users and not fix real 404 errors. Sorry, for the pseudo code, but it's a while ago that I had anything to do with classic ASP and I think you'll get what I mean ;)
sub Session_OnStart
' here should be a Select Case switch or something like that
Response.Redirect("newlocation.asp")
' or if that will work, this would be better (again with switch)
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://company.com/newlocation.asp"
end sub
Hope that helps.
I recommend using URL Rewrite for that, see the following blog about it, in particular "Site Reorganization":
http://blogs.msdn.com/b/carlosag/archive/2008/09/02/iis7urlrewriteseo.aspx
For more info about URL Rewrite see: http://www.iis.net/download/URLRewrite
You can try ISAPIRewrite since it's classic ASP + IIS6
http://www.isapirewrite.com/
They have a lite version which is free, probably good enough for your use.
urlrewrite will only work if you can install a dll on the server
one of these articles will help
http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=qRR&q=url+rewrite+classic+asp&btnG=Search&aq=f&oq=&aqi=g-m1
basically you have to point 404 errors to an error page which will parse the incoming querystring / post info and redirect user to correct location with incoming parameters added.
variations on that theme will be found in the examples fro google.

IIS 404 Custom Error: URL return response code 200 instead

I'm trying to return a custom 404 page using IIS6. (I have a site that is mostly .shtml pages built using movable type). I have tried it 2 ways:
1) set the 404 error handler in IIS to be type "file" with the path \404.html. This works, but it also means that I can't import the header and footer of my site (hence the .shtml) Trying to point the 404 error handler to 404.shtml results in the default 404 page...i guess IIS can't process shtml files in the 404.
2) set the type to "URL". This works great, except that the response code is no longer 404! Its a 200.
How can I get IIS to respond with a 404 response code with the content of my 404.shtml file?
Given that it's IIS, adding
<% Response.Status = "404 Not Found" %>
to the top of 404.shtml should change the response code to 404.
I am not on a windows machine so I am unable to test it at the moment to verify.
Update:
I was finally able to run a few tests on a IIS 6. As you mentioned in a comment to my post, an .shtml file does not allow script commands to run. So there are at least two ways to work around this:
Instead of naming your custom 404 handling page 404.shtml, name it 404.asp. The user should never see the actual name of the page so it shouldn't cause any issues. Note that "Active Server Pages" must be set to 'Allowed' in the Web Service Extensions folder of IIS.
Modify the page extension mapping for .shtml to use asp.dll instead of ssinc.dll. You can do this from IIS by selecting the website and viewing Properties -> Home Directory tab -> Configuration -> Mappings tab. Note that this is far from an ideal solution because now all your .shtml files will be processed by asp.dll. This could cause your pages to render more slowly (assuming asp.dll processes files more slowly than ssinc.dll due to greater complexity) and violates the principle of least privilege.
If neither of the options fit your situation, then it may still be possible but the solution isn't immediately obvious to me.
In IIS Manager, open the Properties of your Web site (or virtual dir) and go to the Custom Errors tab. There you can set which file is sent in case of each error code, including 404.

Resources