Exemple #1
0
        //Costruttore con possibiltà di specificare i valori di SSOCheckUrl, webCheckSessionSSOUrl e additionalData
        public CohesionSSO(HttpRequest request, HttpResponse response, System.Web.SessionState.HttpSessionState session, string SSOCheckUrl, string webCheckSessionSSOUrl, string additionalData)
        {
            this.request = request;
            this.response = response;
            this.session = session;

            this.SSOCheckUrl = SSOCheckUrl;
            this.webCheckSessionSSOUrl = webCheckSessionSSOUrl;
            this.additionalData = additionalData;
            if (this.additionalData == null)
                this.additionalData = "";
        }
Exemple #2
0
        //Costruttore minimo obbligatorio
        public CohesionSSO(HttpRequest request, HttpResponse response, System.Web.SessionState.HttpSessionState session)
        {
            this.request = request;
            this.response = response;
            this.session = session;

            this.SSOCheckUrl = System.Configuration.ConfigurationManager.AppSettings["sso.check.url"];
            this.webCheckSessionSSOUrl = System.Configuration.ConfigurationManager.AppSettings["sso.webCheckSessionSSO"];
            this.additionalData = System.Configuration.ConfigurationManager.AppSettings["sso.additionalData"];
            if (this.additionalData == null)
                this.additionalData = "";
        }
Exemple #3
0
 public static ParameterStream getStream(System.Web.SessionState.HttpSessionState session)
 {
     return((ParameterStream)session[sessionName]);
 }
 public void Invoke(System.Web.SessionState.HttpSessionState session, Next2Friends.Soap2Bin.Core.DataInputStream input)
 {
     _result = HttpProcessor.GetClient <AskServiceSoapClient>(session).GetQuestions(
         input.ReadString(),
         input.ReadString());
 }
 public static void LogoutUser(System.Web.SessionState.HttpSessionState _Session)
 {
     _Session["UserIP"] = null;
     _Session["User"]   = null;
 }
 /// <summary>
 /// 防止Session[key]为null时报错
 /// </summary>
 /// <param name="o"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public static object Get(this System.Web.SessionState.HttpSessionState o, string key)
 {
     return((o.Contents[key] == null) ? "" : o.Contents[key]);
 }
Exemple #7
0
 override public void run(HttpResponse response, System.Web.SessionState.HttpSessionState session)
 {
     base.response = response;
     currentStep   = 0;
     steps.ElementAt(currentStep).start(this, response, session);
 }
Exemple #8
0
 public void ProcessRequest(HttpContext context)
 {
     Server = context.Server;
     Response = context.Response;
     Request = context.Request;
     Cache = context.Cache;
     Session = context.Session;
     Main();
 }
 public Registry(System.Web.SessionState.HttpSessionState session)
 {
     session.Add(sessionName, this);
     algorithms = new List <Analysis.Analysis>();
     datasets   = new List <System.Data.DataSet>();
 }
        public static void AlmacenarDatosGenerales(IUsuarios oUsuario, System.Web.SessionState.HttpSessionState sesion)
        {
            string sCultura          = null;
            string sEmpresaID        = null;
            string sAgenciaID        = null;
            string sUnidadNegocioID  = null;
            string sCobrandedID      = null;
            string sCantidadOpciones = null;
            string sEtapaProduccion  = null;
            string sUsuarioID        = null;

            int iIntUsuarioID    = 0;
            int iAgenciaID       = 0;
            int iUnidadNegocioID = 0;

            //IUsuarios oUsuario = (IUsuarios) Session["Usuario"];
            iAgenciaID = oUsuario.AgenciaID;
            if (iAgenciaID == 0)
            {
                sAgenciaID = ConfigurationSettings.AppSettings["AgenciaConectadaID"];
                sesion.Add("AgenciaConectadaID", sAgenciaID);
            }
            else
            {
                sesion.Add("AgenciaConectadaID", iAgenciaID);
            }

            iUnidadNegocioID = oUsuario.UnidadNegocioID;
            if (iUnidadNegocioID == 0)
            {
                sUnidadNegocioID = ConfigurationSettings.AppSettings["UnidadNegocioID"];
                sesion.Add("UnidadNegocioID", sUnidadNegocioID);
            }
            else
            {
                sesion.Add("UnidadNegocioID", iUnidadNegocioID);
            }

            sUsuarioID = oUsuario.Login;
            if (sUsuarioID == null || sUsuarioID.Length == 0)
            {
                sUsuarioID = ConfigurationSettings.AppSettings["UsuarioConectadoID"];
            }
            sesion.Add("UsuarioConectadoID", sUsuarioID);

            iIntUsuarioID = oUsuario.UsuarioID;
            if (iIntUsuarioID == 0)
            {
                iIntUsuarioID = Convert.ToInt32(ConfigurationSettings.AppSettings["IntUsuarioConectadoID"]);
            }
            sesion.Add("IntUsuarioConectadoID", iIntUsuarioID);

            //sCultura = req["Cultura"];
            if (sCultura == null || sCultura.Length == 0)
            {
                sCultura = ConfigurationSettings.AppSettings["CulturaDefault"];
            }
            sesion.Add("Cultura", sCultura);

            //sCantidadOpciones = req["CantidadOpciones"];
            if (sCantidadOpciones == null || sCantidadOpciones.Length == 0)
            {
                sCantidadOpciones = ConfigurationSettings.AppSettings["CantidadOpciones"];
            }
            sesion.Add("CantidadOpciones", sCantidadOpciones);

            //sEtapaProduccion = req["EtapaProduccion"];
            if (sEtapaProduccion == null || sEtapaProduccion.Length == 0)
            {
                sEtapaProduccion = ConfigurationSettings.AppSettings["EtapaProduccion"];
            }
            sesion.Add("EtapaProduccion", sEtapaProduccion);
        }
        public static void AlmacenarDatosGenerales(System.Web.HttpRequest req, System.Web.SessionState.HttpSessionState sesion)
        {
            string sCultura          = null;
            string sEmpresaID        = null;
            string sAgenciaID        = null;
            string sUnidadNegocioID  = null;
            string sCobrandedID      = null;
            string sCantidadOpciones = null;
            string sEtapaProduccion  = null;
            string sUsuarioID        = null;

            //int iUsuarioID = null;

            sEmpresaID = req["EmpresaID"];
            if (sEmpresaID == null || sEmpresaID.Length == 0)
            {
                sEmpresaID = ConfigurationSettings.AppSettings["EmpresaDefaultID"];
            }
            sesion.Add("EmpresaID", sEmpresaID);

            sAgenciaID = req["AgenciaConectadaID"];
            if (sAgenciaID == null || sAgenciaID.Length == 0)
            {
                sAgenciaID = ConfigurationSettings.AppSettings["AgenciaConectadaID"];
            }
            sesion.Add("AgenciaConectadaID", sAgenciaID);

            sUnidadNegocioID = req["UnidadNegocioID"];
            if (sUnidadNegocioID == null || sUnidadNegocioID.Length == 0)
            {
                sUnidadNegocioID = ConfigurationSettings.AppSettings["UnidadNegocioID"];
            }
            sesion.Add("UnidadNegocioID", sUnidadNegocioID);

            sCobrandedID = req["CobrandedID"];
            if (sCobrandedID == null || sCobrandedID.Length == 0)
            {
                sCobrandedID = ConfigurationSettings.AppSettings["CobrandedDefaultID"];
            }
            sesion.Add("CobrandedID", sCobrandedID);

            sCultura = req["Cultura"];
            if (sCultura == null || sCultura.Length == 0)
            {
                sCultura = ConfigurationSettings.AppSettings["CulturaDefault"];
            }
            sesion.Add("Cultura", sCultura);

            sCantidadOpciones = req["CantidadOpciones"];
            if (sCantidadOpciones == null || sCantidadOpciones.Length == 0)
            {
                sCantidadOpciones = ConfigurationSettings.AppSettings["CantidadOpciones"];
            }
            sesion.Add("CantidadOpciones", sCantidadOpciones);

            sEtapaProduccion = req["EtapaProduccion"];
            if (sEtapaProduccion == null || sEtapaProduccion.Length == 0)
            {
                sEtapaProduccion = ConfigurationSettings.AppSettings["EtapaProduccion"];
            }
            sesion.Add("EtapaProduccion", sEtapaProduccion);

            sUsuarioID = req["UsuarioConectadoID"];
            if (sUsuarioID == null || sUsuarioID.Length == 0)
            {
                sUsuarioID = ConfigurationSettings.AppSettings["UsuarioConectadoID"];
            }
            sesion.Add("UsuarioConectadoID", sUsuarioID);

            /*iUsuarioID = req["IntUsuarioConectadoID"];
             * if (iUsuarioID == 0)
             *      iUsuarioID = ConfigurationSettings.AppSettings["IntUsuarioConectadoID"];
             * sesion.Add("IntUsuarioConectadoID", iUsuarioID);*/
        }
Exemple #12
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     _sessionRef = this.Page.Session;
 }
 public SignInState()
 {
     this.Session = System.Web.HttpContext.Current.Session;
 }
Exemple #14
0
 public static void SessionIdiomaSet(System.Web.SessionState.HttpSessionState pSession, string pValue)
 {
     pSession["myapplication.language"] = pValue;
 }
        private void DownMailFunc(M_UserInfo mu, System.Web.SessionState.HttpSessionState session)
        {
            string ppath = function.VToP(SiteConfig.SiteOption.UploadDir + "\\" + mu.UserName + mu.UserID + @"\EMail\");

            SafeSC.CreateDir(ppath);
            DataTable    mailDT  = mailBll.SelMailIDByUid(mu.UserID);//避免重复下载邮件
            DataTable    dt      = configBll.SelByUid(mu.UserID);
            DownMailProg progMod = new DownMailProg();
            //-----------------
            FactoryPop3 popFactory = new FactoryPop3();
            //Pop3 pop= popFactory.CreatePop3();
            //OpenPopPop3 pop = new OpenPopPop3();
            OpenPopPop3 pop = new OpenPopPop3();

            pop.Pop3Port = 110;
            //附件的物理存储路径
            foreach (DataRow dr in dt.Rows)
            {
                pop.Pop3Address   = dr["POP"].ToString();//pop.exmail.qq.com(QQ企业邮箱),pop3.163.com,pop.exmail.qq.com,pop.qq.com
                pop.EmailAddress  = dr["ACount"].ToString();
                pop.EmailPassword = dr["Passwd"].ToString();
                try { if (!pop.Authenticate())
                      {
                          continue;
                      }
                }
                catch (Exception ex) { ZLLog.L("邮件接收异常,邮箱[" + pop.EmailAddress + "],原因:" + ex.Message); continue; }
                int count = pop.GetMailCount();
                progMod.email = pop.EmailAddress;
                progMod.total = count;
                progMod.index = 1;
                for (int i = count, index = 1; i >= 1; i--, index++)//从最后往前加,先更新日期最近的
                {
                    Session["Mail_DownProg"] = JsonConvert.SerializeObject(progMod);
                    try
                    {
                        progMod.index = index;
                        string mailid = pop.GetMailUID(i);
                        mailDT.DefaultView.RowFilter = "MailID='" + mailid + "'";
                        if (mailDT.DefaultView.ToTable().Rows.Count > 0)
                        {
                            continue;                                             //已存在
                        }
                        DateTime sendtime = pop.GetMailDate(i);
                        int      days     = DataConverter.CLng(dr["Days"].ToString()) == 0 ? 30 : DataConverter.CLng(dr["Days"].ToString());
                        //大于指定天数的邮件则不下载
                        if ((DateTime.Now - sendtime).TotalDays > days)
                        {
                            break;
                        }
                        //--------------------模型
                        M_Plat_Mail mailMod = new M_Plat_Mail();
                        mailMod.UserID   = mu.UserID;
                        mailMod.Sender   = pop.GetSendMialAddress(i);
                        mailMod.Title    = pop.GetMailSubject(i);
                        mailMod.Receiver = pop.EmailAddress;
                        mailMod.Content  = pop.GetMailBodyAsText(i);
                        mailMod.CDate    = DateTime.Now;
                        mailMod.MailDate = sendtime;
                        mailMod.MailID   = mailid;
                        mailMod.Attach   = pop.GetMailAttach(i, ppath);
                        mailMod.Status   = 1;
                        mailBll.Insert(mailMod);
                    }
                    catch (Exception ex)
                    {
                        ZLLog.L("邮件接收异常,邮箱[" + pop.EmailAddress + "],原因:" + ex.Message);
                    }
                }
                pop.Pop3Close();
            }
            //------完成下载
            progMod.iscomplete       = true;
            progMod.index            = progMod.total;
            Session["Mail_DownProg"] = JsonConvert.SerializeObject(progMod);
        }
Exemple #16
0
        //private static SessionManager _sessionManager;

        private SessionManager()
        {
            this.S = HttpContext.Current.Session;
        }
Exemple #17
0
 public SessionHelper(System.Web.SessionState.HttpSessionState stateBase)
 {
     _context = stateBase;
 }
Exemple #18
0
 public override void Create(System.Web.SessionState.HttpSessionState mySession)
 {
     base.Create(mySession);
 }
    public static object Get(this System.Web.SessionState.HttpSessionState session, string key)
    {
        var guid = ???;     // no idea where or how you are getting guid, you never explained that in your question

        return(session[guid + key]);
    }
Exemple #20
0
        ///###############################################################
        /// <summary>
        /// Formats the referenced server structure of data elements into a key/value pair structure.
        /// </summary>
        /// <param name="eServerObject">Enumeration representing the server structure of data elements to encode.</param>
        /// <param name="bIncludeBlankValues">Boolean value indicating if keys with null-string values are to be included.</param>
        /// <returns>String representing a QueryString-style key/value pair structure (i.e. - "key1=value1&amp;key2=value2&amp;key3=value3").</returns>
        ///###############################################################
        /// <LastUpdated>December 2, 2005</LastUpdated>
        public static string KeyValueString(enumServerObject eServerObject, bool bIncludeBlankValues)
        {
            NameObjectCollectionBase.KeysCollection oKeysCollection;
            string sValue;
            string sReturn = "";
            int    i;

            //#### Determine the passed eServerObject and process accordingly
            switch (eServerObject)
            {
            case enumServerObject.cnApplication: {
                HttpApplicationState oApplication = HttpContext.Current.Application;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oApplication.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = Data.Tools.MakeString(oApplication[oKeysCollection[i]], "");

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the sReturn value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            case enumServerObject.cnForm: {
                NameValueCollection oForm = HttpContext.Current.Request.Form;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oForm.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = Data.Tools.MakeString(oForm[oKeysCollection[i]], "");

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the return value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            case enumServerObject.cnQueryString: {
                NameValueCollection oQueryString = HttpContext.Current.Request.QueryString;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oQueryString.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = oQueryString[oKeysCollection[i]];

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the return value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            case enumServerObject.cnSession: {
                System.Web.SessionState.HttpSessionState oSession = HttpContext.Current.Session;

                //#### Retrieve the oKeysCollection
                oKeysCollection = oSession.Keys;

                //#### Traverse the oKeysCollection
                for (i = 0; i < oKeysCollection.Count; i++)
                {
                    //#### Reset the sValue for this loop
                    sValue = Data.Tools.MakeString(oSession[oKeysCollection[i]], "");

                    //#### If we are supposed to bIncludeBlankValues or the sValue is holding data, append it's Key=Value pair onto the return value
                    if (bIncludeBlankValues || sValue.Length > 0)
                    {
                        sReturn += oKeysCollection[i] + "=" + KeyValueStringEncoder(sValue) + "&";
                    }
                }
                break;
            }

            default: {
                Internationalization.RaiseDefaultError(g_cClassName + "BuildKeyValueString", Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_UnknownValue, "eServerObject", Data.Tools.MakeString(eServerObject, ""));
                break;
            }
            }

            //#### If the sReturn value is holding key/value data, remove the trailing "&" (borrowing the use of i to store the sReturn value's .Length)
            i = sReturn.Length;
            if (i > 0)
            {
                //#### Clip off the trailing &
                sReturn = sReturn.Substring(0, sReturn.Length - 1);
            }

            //#### Return the above determined sReturn value to the caller
            return(sReturn);
        }
Exemple #21
0
 public void start(Analysis parent, HttpResponse response, System.Web.SessionState.HttpSessionState session)
 {
     caller = parent;
     Debug.WriteLine("SelectData step of " + caller.getDisplayName() + " started");
     response.Redirect("~/Analysis/Common/Steps/SelectDataset.aspx");
 }
Exemple #22
0
 override public void next(HttpResponse response, System.Web.SessionState.HttpSessionState session)
 {
     currentStep++;
     steps.ElementAt(currentStep).start(this, response, session);
 }
 /// <summary>
 /// Clears this instance.
 /// </summary>
 public void Clear()
 {
     System.Web.SessionState.HttpSessionState session = HttpContext.Current.Session;
     session.Clear();
     session.Abandon();
 }
 public Authentication(System.Web.UI.UserControl Parent)
 {
     this.Application = Parent.Application;
     this.Session = Parent.Session;
     //this.PERMISSION_PAGE = Enum.GetNames(typeof(FUN_INTERFACE));
 }
 public UserAircraft(string szUser)
 {
     User      = szUser;
     m_session = (HttpContext.Current == null) ? null : HttpContext.Current.Session;
 }
 public static User GetSessionUser(System.Web.SessionState.HttpSessionState _Session)
 {
     return((User)_Session["User"]);
 }
 public static T GetValue <T>(this System.Web.SessionState.HttpSessionState obj, string value)
 {
     if (string.IsNullOrEmpty(value) || obj == null || obj[value] == null)
     {
         return(default);
Exemple #28
0
 public ParameterStream(System.Web.SessionState.HttpSessionState Session)
 {
     Session.Add(sessionName, this);
     this.Session = Session;
 }
Exemple #29
0
        /// <summary>
        /// 同名用户再次登录时,弹出前次用户
        /// </summary>
        /// <param name="user"></param>
        /// <param name="UserTable"></param>
        /// <param name="KilledUserTable"></param>
        /// <param name="Session"></param>
        public static void KillUser(User user, Hashtable UserTable, Hashtable KilledUserTable, System.Web.SessionState.HttpSessionState Session)
        {
            try
            {
                //系统管理员(用户代码为“0”)不弹出
                if (user.UserCode == "0")
                {
                    return;
                }

                ArrayList al = new ArrayList();
                foreach (object objKey in UserTable.Keys)
                {
                    if (objKey.ToString().StartsWith(user.UserCode + ",") && (objKey.ToString() != user.UserCode + "," + Session.SessionID))
                    {
                        if (!KilledUserTable.Contains(objKey.ToString()))
                        {
                            KilledUserTable.Add(objKey.ToString(), user.UserName);
                        }

                        al.Add(objKey.ToString());
//                        UserTable.Remove(objKey);
                    }
                }

                foreach (string key in al)
                {
                    UserTable.Remove(key);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #30
0
 public DinnerSession(System.Web.SessionState.HttpSessionState HttpSession)
     : base(HttpSession)
 {
 }
Exemple #31
0
 public void start(Analysis parent, HttpResponse response, System.Web.SessionState.HttpSessionState session)
 {
     session["stepid"] = 2;
     response.Redirect("~/Default.aspx");
     //response.Redirect("~/Analysis/PCA/Steps/PCA_Config.aspx");
 }
        public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            UserFeedbackDb       db       = new UserFeedbackDb();
            UserFeedbackFormInfo formInfo = db.getUserFeedbackFormInfo(page, identifier, langToRenderFor, true);
            string ControlId = "UserFeedbackInfo_" + page.ID.ToString() + "_" + identifier.ToString() + "_" + langToRenderFor.shortCode + "_";

            string _errorMessage = "";
            string action        = PageUtils.getFromForm(ControlId + "Action", "");
            UserFeedbackSubmittedData submittedData = new UserFeedbackSubmittedData();
            bool formValuesLoadedFromSession        = false;

            if (action.Trim().ToLower() == "send")
            {
                // -- get the spam question index
                int spamQuestionIndex = (PageUtils.getFromForm(ControlId + "spamQuestionIndex", SpamTestQuestion.GetRandomQuestionIndex()));
                if (spamQuestionIndex >= SpamTestQuestion.Questions.Length || spamQuestionIndex < 0)
                {
                    spamQuestionIndex = SpamTestQuestion.GetRandomQuestionIndex();
                }

                SpamTestQuestion questionToAnswer = SpamTestQuestion.Questions[spamQuestionIndex];

                string spamQuestionAnswer = (PageUtils.getFromForm(ControlId + "spamQuestionAnswer", ""));

                submittedData.Name          = (PageUtils.getFromForm(ControlId + "Name", ""));
                submittedData.Name          = submittedData.Name.Trim();
                submittedData.EmailAddress  = PageUtils.getFromForm(ControlId + "Email", "");
                submittedData.EmailAddress  = submittedData.EmailAddress.Trim();
                submittedData.Location      = PageUtils.getFromForm(ControlId + "Location", "");
                submittedData.Location      = submittedData.Location.Trim();
                submittedData.TextAreaValue = PageUtils.getFromForm(ControlId + "Comments", "");
                submittedData.TextAreaValue = submittedData.TextAreaValue.Trim();
                submittedData.ReferringUrl  = PageUtils.getFromForm(ControlId + "Referer", "");

                // -- validate user submitted values
                if (questionToAnswer.Answer != spamQuestionAnswer)
                {
                    _errorMessage = "Your answer to the math question was incorrect. Please try again.";
                }
                else if (submittedData.Name == "")
                {
                    _errorMessage = getErrorEnterNameText(langToRenderFor);
                }
                else if (submittedData.EmailAddress == "")
                {
                    _errorMessage = getErrorEnterEmailText(langToRenderFor);
                }
                else if (!PageUtils.isValidEmailAddress(submittedData.EmailAddress))
                {
                    _errorMessage = getErrorEnterValidEmailText(langToRenderFor);
                }
                else if (submittedData.TextAreaValue == "")
                {
                    _errorMessage = getErrorEnterTextAreaQuestionText(langToRenderFor) + formInfo.TextAreaQuestion;
                }
                else
                {
                    // -- save the submitted value
                    submittedData.dateTimeSubmitted = DateTime.Now;
                    submittedData.TextAreaQuestion  = formInfo.TextAreaQuestion;

                    if (db.saveUserFeedbackSubmittedData(submittedData))
                    {
                        // -- success
                        //    save submitted values to the current session
                        if (HttpContext.Current != null && HttpContext.Current.Session != null)
                        {
                            System.Web.SessionState.HttpSessionState session = System.Web.HttpContext.Current.Session;
                            session[ControlId + "Name"]     = submittedData.Name;
                            session[ControlId + "Email"]    = submittedData.EmailAddress;
                            session[ControlId + "Location"] = submittedData.Location;
                        }
                        //    send notification email message
                        sendAdministratorNotification(formInfo, submittedData);
                        //   output the Thankyou message
                        writer.Write("<p><strong>" + formInfo.ThankyouMessage + "</strong></p>");
                        return;
                    }
                    else
                    {
                        _errorMessage = getErrorSavingText(langToRenderFor);
                    }
                }
            } // if save posted values
            else
            {
                // -- get previously submitted values from the current session
                if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Session != null)
                {
                    System.Web.SessionState.HttpSessionState session = System.Web.HttpContext.Current.Session;
                    if (session[ControlId + "Name"] != null)
                    {
                        submittedData.Name          = session[ControlId + "Name"].ToString();
                        formValuesLoadedFromSession = true;
                    }
                    if (session[ControlId + "Email"] != null)
                    {
                        submittedData.EmailAddress  = session[ControlId + "Email"].ToString();
                        formValuesLoadedFromSession = true;
                    }
                    if (session[ControlId + "Location"] != null)
                    {
                        submittedData.Location      = session[ControlId + "Location"].ToString();
                        formValuesLoadedFromSession = true;
                    }
                }
            }


            StringBuilder html = new StringBuilder();

            if (_errorMessage != "")
            {
                html.Append("<p class=\"FormErrorMessage\">" + _errorMessage + "</p>");
            }

            string formId = "UserFeedback";

            html.Append(page.getFormStartHtml(formId));

            html.Append("<em>" + getCompleteAllText(langToRenderFor) + "</em> ");
            if (formValuesLoadedFromSession)
            {
                html.Append(getValuesPreloadedText(langToRenderFor));
            }

            html.Append("<table>");
            html.Append("<tr>");
            html.Append("<td valign=\"top\">" + getNameText(langToRenderFor) + ":");
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "Name", ControlId + "Name", submittedData.Name, formInfo.FormFieldDisplayWidth, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td valign=\"top\">" + getEmailText(langToRenderFor) + ":");
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "Email", ControlId + "Email", submittedData.EmailAddress, formInfo.FormFieldDisplayWidth, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td valign=\"top\">" + getLocationText(langToRenderFor) + ":");
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "Location", ControlId + "Location", submittedData.Location, formInfo.FormFieldDisplayWidth, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td valign=\"top\">");
            html.Append(formInfo.TextAreaQuestion);
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getTextAreaHtml(ControlId + "Comments", ControlId + "Comments", "", formInfo.FormFieldDisplayWidth, 7));
            html.Append("</td>");
            html.Append("</tr>");

            // -- spam stop question
            int qIndex = SpamTestQuestion.GetRandomQuestionIndex();
            SpamTestQuestion spamQuestion = SpamTestQuestion.Questions[qIndex];

            html.Append("<tr>");
            html.Append("<td valign=\"top\">");
            html.Append(spamQuestion.Question);
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "spamQuestionAnswer", ControlId + "spamQuestionAnswer", "", 5, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("</table>");

            html.Append(PageUtils.getHiddenInputHtml(ControlId + "spamQuestionIndex", qIndex.ToString()));
            html.Append(PageUtils.getHiddenInputHtml(ControlId + "Action", "send"));
            html.Append(PageUtils.getHiddenInputHtml(ControlId + "Referer", PageUtils.getFromForm("r", "(unknown)")));

            html.Append("<input type=\"submit\" value=\"" + getSubmitButtonText(langToRenderFor) + "\">");
            html.Append(page.getFormCloseHtml(formId));

            writer.Write(html.ToString());
        } // RenderView
        /// <summary>
        /// 画面起動時に実行されるEvent Handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //画面にError Message・エラー情報を表示する-----------------------------

            //Error MessageをHTTPコンテキストから取得
            string err_msg =
                (string)HttpContext.Current.Items[FxHttpContextIndex.SYSTEM_EXCEPTION_MESSAGE];

            //エラー情報をHTTPコンテキストから取得
            string err_info =
                (string)HttpContext.Current.Items[FxHttpContextIndex.SYSTEM_EXCEPTION_INFORMATION];

            //画面にError Messageを表示する
            this.Label1.Text = CustomEncode.HtmlEncode(err_msg);

            //画面にエラー情報を表示する
            this.Label2.Text = CustomEncode.HtmlEncode(err_info);

            // ------------------------------------------------------------------------

            //画面にフォーム情報を表示する---------------------------------------------

            //HTTPリクエスト フォーム情報
            HttpRequest req = HttpContext.Current.Request;

            //コレクション
            System.Collections.Specialized.NameValueCollection froms = req.Form;

            if (froms != null)
            {
                //foreach
                foreach (string strKey in froms)
                {
                    if (froms[strKey] == null)
                    {
                        al_form.Add(new PositionData(strKey, "null"));
                    }
                    else
                    {
                        al_form.Add(new PositionData(strKey, CustomEncode.HtmlEncode(froms[strKey].ToString())));
                    }
                }

                //データバインド
                this.Repeater1.DataSource = al_form;
                this.Repeater1.DataBind();
            }

            // ------------------------------------------------------------------------

            // 画面にセッション情報を表示する------------------------------------------

            //HTTPセッション情報
            System.Web.SessionState.HttpSessionState sess = HttpContext.Current.Session;

            if (sess != null)
            {
                //foreach
                foreach (string strKey in sess)
                {
                    if (sess[strKey] == null)
                    {
                        al_session.Add(new PositionData(strKey, "null"));
                    }
                    else
                    {
                        al_session.Add(new PositionData(strKey, CustomEncode.HtmlEncode(sess[strKey].ToString())));
                    }
                }

                //データバインド
                this.Repeater2.DataSource = al_session;
                this.Repeater2.DataBind();
            }

            // ------------------------------------------------------------------------

            // セッション情報を削除する------------------------------------------------

            if ((bool)HttpContext.Current.Items[FxHttpContextIndex.SESSION_ABANDON_FLAG])
            {
                // 2009/09/18-start

                // セッション タイムアウト検出用Cookieを消去
                // ※ Removeが正常に動作しないため、値を空文字に設定 = 消去とする

                // Set-Cookie HTTPヘッダをレスポンス
                Response.Cookies.Set(FxCmnFunction.DeleteCookieForSessionTimeoutDetection());

                // 2009/09/18-end

                try
                {
                    // セッションを消去
                    Session.Abandon();
                }
                catch (Exception ex2)
                {
                    // エラー発生時

                    // このカバレージを通過する場合、
                    // おそらく起動した画面のパスが間違っている。
                    Console.WriteLine("このカバレージを通過する場合、おそらく起動した画面のパスが間違っている。");
                    Console.WriteLine(ex2.Message);
                }
            }
        }
 public InfoExchange(System.Web.SessionState.HttpSessionState Session, string IDName)
 {
     this.IDName  = IDName;
     this.Session = Session;
 }
 public SqlSchedulerProvider(System.Web.SessionState.HttpSessionState session)
 {
     _session = session;
 }
Exemple #36
0
        //Helper static

        public static Registry getRegistry(System.Web.SessionState.HttpSessionState session)
        {
            return((Registry)session[sessionName]);
        }
 public ParameterStream(System.Web.SessionState.HttpSessionState Session)
 {
     Session.Add(sessionName, this);
     this.Session = Session;
 }
 public BotonesNomina(System.Web.SessionState.HttpSessionState _session)
 {
     Session = _session;
 }
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     _sessionRef = this.Page.Session;
 }