asp.net - Custom Error Page for 'Illegal Characters in path' -


the custom error page set in web.config not displayed when error of "illegal characters in path" raised. work other server errors, i'm not sure if there can do?

example request correctly shows custom error page: website.com/3f.jsp

example request not: website.com/%3f.jsp

web.config: <customerrors mode="on" defaultredirect="errordisplay.aspx"></customerrors>

stacktrace (customerrors off)

[argumentexception: illegal characters in path.]    system.security.permissions.fileiopermission.hasillegalcharacters(string[] str) +276    system.security.permissions.fileiopermission.addpathlist(fileiopermissionaccess access, string[] pathlistorig, boolean checkforduplicates, boolean needfullpath, boolean copypathlist) +88    system.security.permissions.fileiopermission..ctor(fileiopermissionaccess access, string[] pathlist, boolean checkforduplicates, boolean needfullpath) +43    system.io.path.getfullpath(string path) +82    system.web.httpapplication.checksuspiciousphysicalpath(string physicalpath) +19    system.web.configuration.httpconfigurationsystem.composeconfig(string reqpath, ihttpmappath configmap) +175    system.web.httpcontext.getcompleteconfigrecord(string reqpath, ihttpmappath configmap) +434    system.web.httpcontext.getcompleteconfig() +49    system.web.httpcontext.getconfig(string name) +195    system.web.customerrors.getsettings(httpcontext context, boolean canthrow) +20    system.web.httpresponse.reportruntimeerror(exception e, boolean canthrow) +39    system.web.httpruntime.finishrequest(httpworkerrequest wr, httpcontext context, exception e) +486 

i tried manually catch error in global.asax application_error handler, never gets called. application_beginrequest doesn't called when there illegal characters, iis throwing error , there way me display custom page?

according this article may out of luck.

as stack trace shows , observed in application_beginrequest not getting called, error occurs in iis's request handling before application code gets called - answer first question: therefore, web.config , application_error implementation not considered.

a related discussion on asp.net forums indicates too.

on local iis (7.5) server, back...

bad request - invalid url

http error 400. request url invalid.

...for url http://localhost/%&what.

curious, tried setting static custom error page http status code 400 under local server's error pages in iis manager, configuring local server use custom error pages local , remote requests; never saw custom error page set particular error.

a technet article explains why:

you cannot customize following http errors: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, , 505.

so think answer second question is, no, iis not provide way display custom error page this.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -