How to make IIS7 serve custom content with status code 404 - iis

I have a classic ASP page that sets the response header to 404 Not Found plus some you might be interested in links:
Response.Clear
Response.Status = "404 Not Found"
Response.Write "<h1>Oops</h1>"
Response.Write "<p>The page you requested was not found</p>"
Response.Write "<p>But we have some suggestions:</p>"
This code ran fine on IIS6 i.e. it sent correct response code plus the content. However, on IIS7, all I get is this:
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
How can I make IIS show my content without changing configuration (if possible).

Firstly, ensure that the application pool for the site is running in "Classic Mode". To set this, select the application pool for the site in IIS, click "Basic Settings..." and set "Managed pipeline mode" to "Classic".
Next, select the site in IIS and, click the "Error pages" icon. Click "Edit Feature Settings..." and make sure "error responses" is set to "Custom Error Pages".
You should then find you can set the 404 error to execute your ASP page.

Related

Unable to access agent settings to publish

Accessing Dialogflow "https://dialogflow.cloud.google.com", I can work on my agent as expected. However, I cannot click on the gear icon to access settings like publishing. (img below)
When i select the drop down menu, it endlesly indicates "loading agents..."
I have tried with chrome, firefox, and safari, made sure that cookies are not being blocked.
Checking on chrome's devtools, i see the following error for one of the calls
https://dialogflow.clients6.google.com/v2beta1/projects/-/locations/global/agent:search?requestSource=DIALOGFLOW_CONSOLE&pageToken&pageSize=1000&key=(mykey)
{
"error": {
"code": 503,
"message": "The service is currently unavailable.",
"status": "UNAVAILABLE"
}
}
Non active gear
I just found the URL for the settings page. It is not a solution but a work-around.
The format is as follows:
https://dialogflow.cloud.google.com/#/editAgent/**yourAgentName**/languages

www.server.com/*.aspx returns server error rather than custom error

I have updated my customerr folder to have a common error page which will be displayed for any sort of error.
www.server.com/wrongone
takes to me to the custom error page. -> Working fine
www.server.com/correctone/wrongone.aspx -> This is handled at application level, so I have no problem with this.
But when I hit www.server.com/wrongone.aspx,
It displays Server error. -> I dont want to display server error
What should I do ( at IIS Level) to redirect this to custom error page?
It depend on what status did you get. To set custom error page for .aspx file, you should set .NET error page <customError> instead of error page.
You could find it in IIS manager->site node->.NET error page and you need to add rule for your status code/error page. When you hit the error status code, the page will be redirected to your custom error page. If your status code is 500, then custom page would fail in some case.
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/hh831398(v%3Dws.11)

Getting "connection was reset" when uploading large files using the file upload control

When I'm trying to upload large files (>10Mb) with a file upload control in my XPages application, I'm always redirected to an error page in my browser, saying "The connection to the server was reset while the page was loading". In the application's xsp.properties file I already set "xsp.upload.maximumsize=128000" which should allow uploads of files with up to 128Mb. However I keep getting the "connection was reset" error. Does anybody know how to fix this problem?
In addition to xsp.upload.maximumsize setting you have to set values in Domino Directory in server document in "Internet Protocols..." tab:
Set fields
"HTTP" tab / "HTTP Protocol Limits" section / "Maximum size of request content" and
"Domino Web Engine" tab / "POST Data" section / "Maximum POST data"
to value 128000 too.

Get Page URL on 404 IIS Redirection (Custom Error Page in Classic ASP)

I have implemented IIS Redirection on 404 error code and created a Custom Error Page for it. My Custom error page is written in classic asp (e.g: FileNotFound.asp). I need to write the URL of calling page (which does not exists) in my Custom Error Page.
You need the following:
Request.ServerVariables (server_variable)
Replace it with:
Request.ServerVariables (HTTP_REFERER)
That should work. Article on it at w3Schools: http://www.w3schools.com/asp/coll_servervariables.asp

SharePoint 404 page

Is the best place set the 404 error page for SharePoint within the web.config customError section or is there a configuration setting on the site collection/ web application?
please have a read at this blog
pasted:
In your MOSS server, make a copy of
%systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033\sps404.html
and call it my404.html
Create a Virtual Directory in IIS under your MOSS root web application. For example /errors
Create your own redirect aspx page, for example /errors/my404redirect.aspx and code your redirect logic in there. This is a normal asp.net page.
In my404.html, make the following change:
STSNavigate("/errors/my404redirect.aspx?oldUrl=" + requestedUrl);
Create a Console Application and insert the following code and run it in MOSS server
System.Uri webApplicationUri = new Uri(http://MyMOSSServer/);
SPWebApplication webApplication = SPWebApplication.Lookup(webApplicationUri);
webApplication.FileNotFoundPage = "my404.html";
webApplication.Update();
Now when you browse to a page that doesn't exist, you should expect to be brought to the redirected page.
I know this has already been answered but an alternative mgith be the following url: http://sharepointsmart404.codeplex.com/ - which should still result in a 404 status code so that search engines remove the page from their cache (eventually)

Resources