Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8710443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:37:38+00:00 2026-06-13T04:37:38+00:00

I want to add a handler mapping (script map) for our custom CGI-Exe to

  • 0

I want to add a handler mapping (script map) for our custom CGI-Exe to an Internet Information Server using the classes in the Microsoft.Web.Administration namespace.
The (simplified) code is:

var serverManager = ServerManager.OpenRemote(serverName);

Configuration webConfig = serverManager.GetWebConfiguration(siteName, appPath);
ConfigurationSection handlersSection = webConfig.GetSection("system.webServer/handlers");

ConfigurationElementCollection handlersCollection = handlersSection.GetCollection();
string elementName = cgiFile + " script map appHost added by ACM";
ConfigurationElement addElement = handlersCollection.CreateElement("add");
addElement["allowPathInfo"] = true;
addElement["modules"] = "CgiModule";
addElement["name"] = elementName;
addElement["path"] = cgiFile;
addElement["requireAccess"] = "Execute";
addElement["scriptProcessor"] = Path.Combine(scriptsPath, cgiFile);
addElement["verb"] = "*";

handlersCollection.Add(addElement);
serverManager.CommitChanges();

This code adds the handler mapping to the mapping list in the IIS, but it is marked as disabled:
screenshot of the disabled handler mapping in the IIS manager

I have to manually select “Edit Feature Permissions…” from the Actions pane and select the “Execute” permission in the following dialog:

screenshot of the Edit Feature Permissions dialog

I want to know how to enable the handler mapping, either by setting different configuration options while creating the handler or by programmatically editing the feature permissions.

Update

I copied the web.config that was created as a result of this script, then I manually added the Execute permission with the dialog above and compared the resulting web.config to the original one:

The start changed from:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>

to

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers accessPolicy="Read, Execute, Script">

Now I need to find out, how to set the accessPolicy. But why is this set on the handlers node and not on my specific handler node?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:37:39+00:00Added an answer on June 13, 2026 at 4:37 am

    Sometimes it helps just to formulate the question on stackoverflow. After playing with this for two days, I found the solution just hours after posting the question:

    I needed to set the accessPolicy for the handlers.

    After adding this line it finally worked:

    handlersSection["accessPolicy"] = "Read, Script, Execute";
    

    It seems I just used the wrong search terms, I looked for “edit feature permissions” instead of accessPolicy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add a custom handler to a default monolog in Symfony 2.
I want to add an event handler to a paragraph for when any user
I want add my custom sidebar next right column all page. Please check this
I want to add an event handler to jqGrid (for the onSelectRow event) but
In QtDesigner, if i have a pushbutton and want to add a handler for
I have initialized a java.util.logging.Logger bean and now want to add a Handler which
I want to add a handler that keeps on executing while a gwt toggle
For robustness I want to add a handler for TaskScheduler.UnobservedTaskException. The handler does log
I want to add an event handler for input text controls. The controls is
I'm using a key up handler to add and remove event handlers depending on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.