小编Dwa*_*ang的帖子

不使用Web.Config配置表单身份验证

脚本


我已经将我的MVC应用程序配置为以传统方式使用Forms身份验证.

<authentication mode="Forms">
  <forms cookieless="UseCookies" slidingExpiration="true" timeout="1">
  </forms>
</authentication>
Run Code Online (Sandbox Code Playgroud)

但是,我允许客户端选择他的Web应用程序如何进行身份验证(URL令牌/ Cookie),以及他的应用程序会话在到期之前应该持续多长时间(超时)


我有办法通过代码执行此操作吗?我只通过web.config看过这个的实现?

我想从数据库中读取设置并将它们应用于Global.asax - > OnApplicationStart()

c# asp.net-mvc forms-authentication web-config global-asax

5
推荐指数
1
解决办法
712
查看次数

SignalR-OWIN-多个端点

我有这样的情况。

派生模块的基类。
每个模块都有自己的信号中心。
我想将所有模块托管在单个主机中,并按模块名称分隔。
某些模块将共享集线器名称。

namespace domain.com.base
{
    public class BaseClass
    {
        public string ApplicationName;
    }
}

namespace domain.com.billing
{
    public class Billing : BaseClass
    {
        ApplicationName = "Billing";
    }
    public class NotificationHub : Hub
    {
        public void Credit(decimal amount)
        {
            Clients.All.Notify(amount);
        }
    }
}

namespace domain.com.reporting
{
    public class Reporting : BaseClass
    {
        ApplicationName = "Reporting";
    }
    public class ReportingHub : Hub
    {
        public Report GetReport(int Id)
        {
             return ReportModule.RetrieveReport(Id);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在OWIN.Startup.Configuration(IAppBuilder)中可以做这样的事情

namespace domain.com.external_access
{
    public void …
Run Code Online (Sandbox Code Playgroud)

startup signalr owin

4
推荐指数
1
解决办法
616
查看次数