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 " />: