locked
How to save session for next day RRS feed

  • Question

  • User643189141 posted

    Hi,

    In the combobox I select BackgroundColor.

    The next day, week, month, I come back to the web site.

    How to save the BackgroundColor for 365 days? For 365 days I want to save the session only BackgroundColor

    using System;
    using System.Data;
    using System.Web;
    
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Session["BackgroundColor"] != null)
            {
                ColorSelector.SelectedValue = Session["BackgroundColor"].ToString();
                BodyTag.Style["background-color"] = ColorSelector.SelectedValue;
            }
        }
    
        protected void ColorSelector_IndexChanged(object sender, EventArgs e)
        {
            BodyTag.Style["background-color"] = ColorSelector.SelectedValue;
            Session["BackgroundColor"] = ColorSelector.SelectedValue;
        }
    }
    Tuesday, October 11, 2011 6:47 AM

Answers

  • User-1283805172 posted

    It is good to save the background color in Database.

    When you came back to site you will retrieve the background color from DB and apply that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 11, 2011 6:57 AM
  • User-1283805172 posted

    Hi,

    Is this background color is same for all the users.

    For example consider the below scenario:

    1. Default background color is white.

    2. If i visit your site and changed the color to Green. After that if someone visit your site what is background color for that user.

    3. If it is green for all the users, in this case also we can save the background color in Database while page is loading we can set the background color.

    Please let me know if i misunderstood your requirement.

    Ravi..

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 11, 2011 7:26 AM

All replies

  • User-1283805172 posted

    It is good to save the background color in Database.

    When you came back to site you will retrieve the background color from DB and apply that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 11, 2011 6:57 AM
  • User643189141 posted

    No it is not good, because users will not be registered.
    So, how can I do this through the session?

    thanks again.


    Tuesday, October 11, 2011 7:15 AM
  • User-1283805172 posted

    Hi,

    Is this background color is same for all the users.

    For example consider the below scenario:

    1. Default background color is white.

    2. If i visit your site and changed the color to Green. After that if someone visit your site what is background color for that user.

    3. If it is green for all the users, in this case also we can save the background color in Database while page is loading we can set the background color.

    Please let me know if i misunderstood your requirement.

    Ravi..

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 11, 2011 7:26 AM
  • User643189141 posted

    No.

    The problem I have is because I want to call in any Session.
    Why? Because the user can change the background color and only that user, I want to show the background color.
    As a second possibility is that I have a combobox in which I have 5 different languages.
    The visitor selects the combobox, it must also appear in the coming days.
    It is possible only with the Session or any other way?
    If the user DB, how to call the language of the user?

    thanks again.

    Tuesday, October 11, 2011 10:20 AM