//private static void OnConnectionOpened(object sender, ConnectionEventArgs e)
        //{
        //	// Register all open connections for disposing at the end of the request
        //	HttpContext httpContext = HttpContext.Current;
        //	if (httpContext != null)
        //	{
        //		HttpContextWrapper httpContextWrapper = new HttpContextWrapper(httpContext);
        //		httpContextWrapper.RegisterForDispose(e.Connection);
        //	}
        //}

        private static void SetUpFormsAuthentication()
        {
            if (ConfigUtil.MySqlSimpleMembershipEnabled)
            {
                NameValueCollection configurationData = new NameValueCollection();

                string appSettingsLoginUrl = ConfigurationManager.AppSettings[FormsAuthenticationSettings.LoginUrlKey];
                if (appSettingsLoginUrl != null)
                {
                    // Allow use of <add key="loginUrl" value="~/MyPath/LogOn" /> as a shortcut to specify
                    // a custom log in url
                    configurationData[LoginUrlKey] = appSettingsLoginUrl;
                }
                else if (!ConfigUtil.ShouldPreserveLoginUrl())
                {
                    // Otherwise, use the default login url, but only if PreserveLoginUrl != true
                    // If PreserveLoginUrl == true, we do not want to override FormsAuthentication's default
                    // behavior because trying to evaluate FormsAuthentication.LoginUrl at this point in a
                    // PreAppStart method would cause app-relative URLs to be evaluated incorrectly.
                    configurationData[LoginUrlKey] = FormsAuthenticationSettings.DefaultLoginUrl;
                }

                FormsAuthentication.EnableFormsAuthentication(configurationData);
            }
        }
Пример #2
0
 public static void Initialize()
 {
     System.Collections.Specialized.NameValueCollection urls = new System.Collections.Specialized.NameValueCollection(2);
     urls.Add("DefaultUrl", "~/Home/Index");
     urls.Add("LoginUrl", "~/Employee/Login");
     FormsAuthentication.EnableFormsAuthentication(urls);
 }
        public static void FormsAuthenticationSetUp()
        {
            var nvc = new NameValueCollection();

            nvc.Add("loginUrl", "/myLogin.aspx");
            nvc.Add("defaultUrl", "/myDefault.aspx");
            FormsAuthentication.EnableFormsAuthentication(nvc);
        }
Пример #4
0
    public static void Configure()
    {
        var settings = new NameValueCollection();

        settings.Add("defaultUrl", "~/Account/Default.aspx");
        settings.Add("loginUrl", "~/Default.aspx");
        settings.Add("timeout", "10");
        FormsAuthentication.EnableFormsAuthentication(settings);
    }
Пример #5
0
        public static void FormsAuthenticationSetUp()
        {
            var nvc = new NameValueCollection();

            nvc.Add("loginUrl", String.Empty);
            nvc.Add("defaultUrl", String.Empty);

            FormsAuthentication.EnableFormsAuthentication(nvc);
        }
 private static void SetupFormsAuthentication()
 {
     if (ConfigUtil.SimpleMembershipEnabled)
     {
         // Allow use of <add key="loginUrl" value="~/MyPath/LogOn" /> as a shortcut to specify
         // a custom log in url
         FormsAuthentication.EnableFormsAuthentication(new NameValueCollection()
         {
             { "loginUrl", ConfigUtil.LoginUrl }
         });
     }
 }
Пример #7
0
        public static void FormsAuthenticationSetUp()
        {
            var nvc = new NameValueCollection();

            nvc.Add("loginUrl", "/myLogin.aspx");
            nvc.Add("defaultUrl", "/myDefault.aspx");
            nvc.Add("cookieDomain", "MyCookieDomain.com");
            FormsAuthentication.EnableFormsAuthentication(nvc);

            nvc ["loginUrl"]   = "/myOtherLogin.aspx";
            nvc ["defaultUrl"] = "/myOtherDefault.aspx";
            FormsAuthentication.EnableFormsAuthentication(nvc);
        }
Пример #8
0
 public static void FormsAuthenticationSetUp()
 {
     FormsAuthentication.EnableFormsAuthentication(new NameValueCollection());
 }
 /// <summary>
 /// Enables authentication.
 /// </summary>
 /// <param name="configurationData">The configuration data.</param>
 public void EnableAuthentication(System.Collections.Specialized.NameValueCollection configurationData)
 {
     FormsAuthentication.EnableFormsAuthentication(configurationData);
 }
 public static void FormsAuthenticationSetUp()
 {
     FormsAuthentication.EnableFormsAuthentication(null);
 }