需要通过添加SSL来保护cookie并更新IIS web.config。
当前的Web.Config中包含以下片段。
<configuration>
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
</system.web>
</configuration>
希望将system.web部分更新如下。
需要修改(假设您会使用Set-WebConfiguration)
<authentication mode="Forms">
to
<authentication mode="Forms" requireSSL="true">
需要添加(假设您将使用Add-WebConfiguration)
<httpCookies httpOnlyCookies="true" />
成功地使用以下内容更新web.config文件:
Add-WebConfigurationProperty -pspath "iis:\Sites\FMC" -filter "/appSettings" -name "." -Value @{key='fmcDataContextType';value='SqlRepository.fmcDataContext'}
但似乎无法找到适合此目的的正确格式。