---
title: "WebConfigurationManager"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/180955-webconfigurationmanager"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "Arne"
published: "2009-10-27T20:43:22.000Z"
updated: "2009-10-27T20:43:22.000Z"
replies: 0
views: 381
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/180955-webconfigurationmanager"
---

# WebConfigurationManager

## #1 — Arne, 2009-10-27T20:43Z

Vill lägga till och radera användare i web.config  via codebehind och har kommit så pass att jag kan lägga till användare. Men jag får det icke att fungera att radera en användare.

```
        Dim config As Configuration = WebConfigurationManager.OpenWebConfiguration("~", Nothing, "admin", "")
        Dim section As AuthorizationSection = CType(config.GetSection("system.web/authorization"), AuthorizationSection)
        Dim rule As New AuthorizationRule(AuthorizationRuleAction.Allow)

        If e.Checked Then
            rule.Users.Add(e.Item("medlemsnr"))
            section.Rules.Add(rule)
        Else
            'detta fungerar ej.....
            rule.Users.Remove(e.Item("medlemsnr"))
            section.Rules.Remove(rule)
        End If

        config.Save()
```

Jag vill alltså radera t.ex användaren 10112 i web.config \<allow users="10112 " /\>:

Permalänk: https://www.webforum.nu/p/180955

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/180955-webconfigurationmanager
