加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET Web.Config转换问题

发布时间:2020-12-16 07:27:31 所属栏目:asp.Net 来源:网络整理
导读:如何使用web.config转换在我的生产web.config中包含domain属性? 我在我的基础web.config中有以下内容. authentication mode="Forms" forms loginUrl="~/Account/Login.aspx" timeout="2880" //authentication 我试图在我的web.prod.config中使用以下内容,但
如何使用web.config转换在我的生产web.config中包含domain属性?

我在我的基础web.config中有以下内容.

<authentication mode="Forms">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>

我试图在我的web.prod.config中使用以下内容,但在发布项目时它不会添加该属性.

<authentication mode="Forms" xdt:Transform="Replace">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880" domain=".mydomain.com" />
</authentication>

我希望输出如下.

<authentication mode="Forms">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880" domain=".mydomain.com"/>
</authentication>

解决方法

这两个中的一个应该工作(未经测试,但基于 Microsoft’s documentation):

<system.web>
  <authentication mode="Forms" xdt:Transform="Replace" xdt:Locator="Match(forms)">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880" domain=".mydomain.com" />
  </authentication>
</system.web>

<system.web>
  <authentication mode="Forms">
    <forms domain=".mydomain.com" xdt:Transform="SetAttributes(domain)" />
  </authentication>
</system.web>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读