PageMethods is not working (Solved)

PageMethods is a JavaScript class that you can use to call a server-side function. It’s basically an AJAX call which works asynchronously. In .NET world, you can use PageMethods to call a C# code-behind function. If you think that PageMethods is not working no matter what you do, keep reading.

For PageMethods to work, you need a JavaScript function on the client-side and a WebMethod function on the server-side.

Sample JavaScript code (Put it in asp:content section of Default.aspx):

<script type="text/jscript">

   function callCodeBehind() {
		PageMethods.GetMessage("test string", onSuccess, onFailure);

   function onSuccess(result, usercontext, methodname) {

   function onFailure(error, usercontext, methodname) { alert("failed: "+ error.get_message()); }


Sample C# code (code-behind file – Default.aspx.cs):

public partial class Welcome : System.Web.UI.Page
	protected void Page_Load(object sender, EventArgs e)


	protected static void GetMessage(string val)
		return "doingit";

A button to call the JavaScript function (in Default.aspx)

<button onclick="callCodeBehind()">Click me</button> 

ScriptManager (in Site.Master – note that EnablePageMethods is set to True):

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">

Having issues with your AJAX call as part of Google reCAPTCHA implementation? Check this post out.

What to do if PageMethods is not working

If you have the code above, your project should be working. In exceptional cases, you may not receive the return value. In my case, the issue was the post-back that was happening after clicking the button.

The reason behind the post-back was that friendy URL setting. As soon as I disabled it, my PageMethods function started working.

In order to disable friendly URL feature, remove or comment out the line below in your RouteConfig file.

Solved PageMethods is not working issue
Successfully returned the value

Are you losing data after a post-back? Here is what to do.


Access to the path C:\Windows\SysWOW64\inetsrv is denied (Solved)

The web browser may throw 401 Unauthorized errors if the application can’t access to a path that is trying to read or write. Therefore, you may see “Access to the path is denied” error.

Here is the full error message:

Access to the path ‘C:\Windows\SysWOW64\inetsrv’ is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path ‘C:\Windows\SysWOW64\inetsrv’ is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose “Properties” and select the Security tab. Click “Add” to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Access to the path is denied

Trying to configure HTTP Redirection in IIS? Check this post out.

Root cause

As the error message states, there is an access issue to a folder. The first thing to check is that Security permissions for the folder mentioned in the error message. The application pool identity of your web application should have permission on this folder.

In my case, the error message referred to C:\Windows\SysWOW64\inetsrv folder. This is the folder IIS uses for configuration and executables. Web applications shouldn’t make any changes to this folder. Therefore, you may want to check your application code to figure out the root cause (An example scenario).

You may ask what SysWOW64 folder is for. This is a folder to handle 32-bit applications in 64-bit systems. More information: WoW64.

How to solve “Access to the path is denied” errors

  1. Open IIS Manager
  2. Go to “Server > Application pools”
  3. Check the value in “Identity” column for the application pool you are using
  4. Go to the folder above the path specified in the error message (C:\Windows\SysWOW64)
  5. Right click and select “Properties” for the folder specified in the error message (inetsrv)
  6. Give “Full Control” permission to the application pool identity you saw in the Step 3 (In my case, I gave permission to “Network Service”)

If assigning permissions doesn’t help, I would recommend trying to enable “32-bit Applications” for the application pool. Additionally, disabling Impersonation may lead you to the solution as well.


Hyper-V machine failed to change state (Solved)

If you are using Hyper-V supervisor to create and manage virtual machines, it is likely to come across this error sooner or later: “Machine failed to change state”. It sometimes appear as “Failed to start”.

The full error message:

The application encountered an error while attempting to change the state of the machine A.

The machine A failed to change state.

Machine failed to change state

Are you receiving “The unsigned image’s hash is not allowed (DB)” error while using Hyper-V? Here is how to fix it.

How to solve “machine failed to change state” error

There are a few possible causes of this issue:

  • There is not enough disk space to start the machine
  • The network adapter of the machine has an issue (Source)
  • An antivirus software is blocking access to VM files (Source)

In order to determine the root cause:

  1. Go to Event Viewer
  2. Expand “Applications and Services Logs > Microsoft > Windows > Hyper-V-Worker”
  3. Click “Admin”. Then, check the events marked as “Error”

In my case, the issue was the disk space.

Event ID 3326:

The Virtual Machine ‘Windows Server 2016 Standard (Base Copy)’ failed to start because there is not enough disk space. The system was unable to create the memory contents file on ‘C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\ABC.VMRS’ with the size of 4096 MB. Set the path to a disk with more storage space or delete unnecessary files from the disk and try again.

Event ID 12030:

‘Windows Server 2016 Standard (Base Copy)’ failed to start. (Virtual machine ID ABC)

Event ID 3050:

The description for Event ID 3050 from source Microsoft-Windows-Hyper-V-Worker cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: Windows Server 2016 Standard (Base Copy)

The locale specific resource for the desired message is not present

Machine failed to change state (Event Viewer)

If you have an error with the event ID 3326, freeing some space in your system should solve the problem. Additionally, you can remove the saved state to free up some space.

Machine failed to change state (saved state)
Delete the saved state of the virtual machine

Looking for ways to clone your Hyper-V virtual machines? Check this post out!