Exemplo n.º 1
0
        protected void Application_BeginRequest()
        {
            if (this.Request.Cookies.Get("idioma") != null)
            {
                string      idioma = this.Request.Cookies.Get("idioma").Value;
                CultureInfo c      = new CultureInfo(idioma);
                Thread.CurrentThread.CurrentCulture   = c;
                Thread.CurrentThread.CurrentUICulture = c;
            }
            else
            {
                CultureInfo c = new CultureInfo(ConfigurationManager.AppSettings["idiomadefecto"]);
                Thread.CurrentThread.CurrentCulture   = c;
                Thread.CurrentThread.CurrentUICulture = c;
            }

            /* byte[] buffer = new byte[this.Request.InputStream.Length];
             * this.Request.InputStream.Read(buffer, 0, buffer.Length);
             * string input = Encoding.UTF8.GetString(buffer);*/
            DateTimeFormatInfo formato = new DateTimeFormatInfo();

            formato.DateSeparator    = "-";
            formato.TimeSeparator    = ":";
            formato.ShortDatePattern = "dd-MM-yyyy";
            formato.ShortTimePattern = "HH:mm:ss";
            Thread.CurrentThread.CurrentCulture.DateTimeFormat   = formato;
            Thread.CurrentThread.CurrentUICulture.DateTimeFormat = formato;
            ResolvedorDependencias.Inicializar();
        }
Exemplo n.º 2
0
        public void Configuration(IAppBuilder app)
        {
            var container = ResolvedorDependencias.ObtenerContenedor();

            container.RegisterInstance <IDataProtectionProvider>(app.GetDataProtectionProvider());
            app.UseCookieAuthentication(new CookieAuthenticationOptions()
            {
                ExpireTimeSpan     = TimeSpan.FromMinutes(30),
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie
            });
        }