Pig*_*guy 5 iis powershell forms-authentication web-config
我的 IIS 看起来像这样:
Sites ->
Default Web Site ->
MyWebApp
Run Code Online (Sandbox Code Playgroud)
那么问题是:如何在 MyWebApp 上启用表单身份验证?我设法更改或编辑匿名访问、基本和 Windows 身份验证。然而,Forms Auth 并不那么容易。如何在 Powershell 中执行此操作?
我可以这样读取设置:
(Get-WebConfiguration system.web/authentication 'IIS:\sites\Default Web Site\MyWebApp').Mode
我在 Set-Webconfiguration 或 Set-Webconfigurationproperty 方面遇到麻烦或没有运气。我发现这些 cmdlet 很难弄清楚。
更改发生在 web.config 中,至少当我在 IIS 管理器中点击“启用”或“禁用表单身份验证”时,web.config 会更新。任何线索和提示都将受到高度赞赏。
修改属性后,您可以将身份验证配置设置通过管道传输到 Set-Webconfiguration,从而提供适当的过滤器:
$config = (Get-WebConfiguration system.web/authentication 'IIS:\sites\Default Web Site')
$config.mode = "Forms"
$config | Set-WebConfiguration system.web/authentication
Run Code Online (Sandbox Code Playgroud)
注意:尝试此操作之前请备份您的配置。
| 归档时间: |
|
| 查看次数: |
8637 次 |
| 最近记录: |