【发布时间】:2016-01-18 10:15:29
【问题描述】:
【问题讨论】:
标签: asp.net-mvc web-config viewbag
【问题讨论】:
标签: asp.net-mvc web-config viewbag
你不应该这样做。
不应根据会话在运行时更改 webconfig。记住每个用户都有他/她自己的会话。这意味着如果同时有多个用户,可能会出现并发问题,这意味着例如您可以在配置中拥有 user1 的用户名和 user2 的密码。
例如,您可以在视图中使用以下内容:
@Html.MvcReportViewer(string reportPath, string reportServerUrl = null, string username = null, string password = null, IEnumerable> reportParameters = null, ControlSettings controlSettings = null, object htmlAttributes = null, FormMethod method = FormMethod.Get)
用户名和密码来自您的 viewbag。
【讨论】: