0

I have a asp.net website hosted in IIS 5 and i don't have access to the source code, but i do have access to server. What i need is a server level way to redirect the user to a custom error page when an exception of the type "SecurityException" occurrs.

Since I can't use it via global asax i was wondering if i could use elmah to catch the error and redirect it to a specific url instead of logging/mailing it.

I'm open to alternatives too.. so if someone knows a trick to do this using a different approach I would appreciated very much.

Thanks!

Best regards, byte_slave

byte_slave
  • 1,368
  • 1
  • 12
  • 24
  • I'm not familiar with ELMAH, but checked it out and it looks promising for your problem. Post back if it works! – JasonS Dec 21 '11 at 18:51
  • Thats what i thought but it doesn't...it just logs the error, send emails, etc...though I might be able to download the sc and inject some redirection at some point on it and might solve my issue...but then i would be using elmah features all over and in i don't need to use elmah at all..in this scenario. – byte_slave Dec 22 '11 at 23:55

2 Answers2

2

ELMAH logs exceptions for you. It will not redirect to a particular page. ELMAH is configured in Web.Config which you do have access to. You can also setup a custom error page in Web.Config.

<customErrors defaultRedirect="url" mode="On">
   <error redirect="PlaceYourUrlHere"/>
</customErrors>

BTW, I had a similar situation once (a laptop with source was stolen). I took the binaries off the server and decompiled them. You can try using JustDecompile, Reflector, Here is another SO question with some more decompile alternatives: A .net disassembler/decompiler

Once you have decompiled the binaries you can put back together the project and solution files. Of course assuming the binaries are not obfuscated or encrypted in some manner. But this is rarely done for web apps, so I would give it a shot.

Community
  • 1
  • 1
santiagoIT
  • 9,411
  • 6
  • 46
  • 57
  • Your right! Thanks for pointing out some nice decompiling tools... So i'm now using a custom httpmodule and catch my error in the application error event... aparently all works fine, but the error event never triggers and therefore i can't so the so wanted redirection... probably at some point before the module is executed in the http pipeline the errors in the server are cleared and therefore won't trigger this is my suspiction as i was able to test that module load perfectly, just does't hot the error. Guess this is enough from a new post here in SO.. Thanks! – byte_slave Dec 22 '11 at 23:59
1

Ok. So the way i fix this, was downloading and compiling a ELMAH source code, with a very small change in the code to catch the desired exceptions and then it redirects to the address I want.

byte_slave
  • 1,368
  • 1
  • 12
  • 24