Friday, July 25, 2008

Try Catch & System.Threading.ThreadAbortException : Unable to evaluate expression because the code is optimized or a native frame is on top of the cal

Hi,

In my asp.net application i have developed some functionality which was working fine until I added try catch block. The issue is when Response.Redirect("URL"); is getting executed there occurs System.Threading.ThreadAbortException with message "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack".

The reason for this exception is because Response.Redirect, when called with just the URL, or with the URL and a Boolean value of true, calls the Response.End method. Response.End then calls Thread.Abort on the current thread which will result in ThreadAbortException.

So the best solution is to call redirect like Response.Redirect("URL",false) or after try catch block...

Regards
Fauzi

Monday, July 7, 2008

Virus attack which disabled Regedit and Task Manager

Hey all:

Today I felt mysterious to see that the task manager in my machine was disabled & When i tried to run Regedit, an alert was shown saying the user does not have administrative privilege to run this program. Then i ran Anti virus scanning through AVG to get rid of the viruses & found the following steps to enable Task Manger & Regedit from Yahoo Answers...

All these options can be restored through the Group Policy management console.
In order to enable them, please follow the steps below:

1. Open C:\Windows\system32\gpedit.msc

2. In the Group Policy window go to the path:

Local Computer Policy >> User Configuration >> Administrative Templates

3. Find the following entries and perform the necessary adjustments:

- To enable Folder Options:

- Go to Windows Components >> Windows Explorer
- Double-click Removes the Folder Options menu item from the Tools menu
- Select Disabled and confirm with OK

- To enable Task Manager:

- Go to System >> Ctrl+Alt+Del Options
- Double-click Remove Task Manager
- Select Disabled and confirm with OK

- To enable Command Prompt and Regedit:

- Go to System
- Double-click Prevent access to the command prompt
- Select Disabled and confirm with OK
- Double-click Prevent access to registry editing tools
- Select Disabled and confirm with OK

4. Close Group Policy

Hope this should be helpful for people who went puzzled like me :)

Best Regards
Fauzi