Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:09:46+00:00 2026-06-08T17:09:46+00:00

Sorry for the ambiguous question but here I go. On each page a have

  • 0

Sorry for the ambiguous question but here I go.

On each page a have a partial view displaying different theme options. These themes are just different css classes for element colors within the page. How can I allow any visitor to select a different theme, and have it persist on all following requests and sessions, even if the user is not logged in.

I imagine this must be done client side, and all I could think of is something like cookies. Unfortunately I haven’t really experimented with them in ASP.NET yet and cant think of proper wording for a Google search since its such a basic concept.

If anyone can point me in the right direction i’d appreciate it. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:09:47+00:00Added an answer on June 8, 2026 at 5:09 pm

    You could use a concept known as Profile

    With profiles you can declare the properties you would like to expose to your users and this works for anonymous users

    Basically the profile properties are stored in cookies, therefore you can configure when they should expire and other cookies-related settings

    Your profile properties are compiled as part of the top-level items compilation – AKA Compilation Life-Cycle in ASP.Net, therefore they will be exposed as strongly-typed properties through the Profile class

    For example:

    Web.config settings

    <configuration>
      <system.web>
        <anonymousIdentification enabled="true"/>
        <profile defaultProvider="AspNetSqlProfileProvider" enabled="true">
          <properties>
            <add name="FirstName"/>
            <add name="LastName"/>
            <add allowAnonymous="true" name="LastVisit" type="System.Nullable`1[System.DateTime]"/>
            <group name="Address">
              <add name="Street"/>
              <add name="PC"/>
              <add name="InternalNumber" type="System.Int32" defaultValue="0"/>
            </group>
            <add name="EmployeeInfo" serializeAs="Binary" type="EmployeeInfo"/>
          </properties>
        </profile>
      </system.web>
    </configuration>
    

    Consuming the profile in code (Global.asax for this example)

    void Application_EndRequest(object sender, EventArgs e)
    {
        if (Profile != null)
        {
            Profile.LastVisit = DateTime.Now;
            Profile.Save();
        }
    }
    

    Additionally, ASP.Net lets you access the properties in JavaScript, using Microsoft AJAX components:

    Web.config

    <configuration>
      <system.web.extensions>
        <scripting>
          <webServices>
            <profileService enabled="true" readAccessProperties="LastVisit" writeAccessProperties="LastVisit"/>
            <jsonSerialization maxJsonLength="102400" recursionLimit="100" />
          </webServices>
        </scripting>
      </system.web.extensions>
    </configuration>
    

    ASPX

    <script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#profile").click(function () {
                Sys.Services.ProfileService.load();
                Sys.Services.ProfileService.properties.LastVisit = new Date();
                Sys.Services.ProfileService.save(
                    null,
                    function (m) {
                        alert(m);
                    },
                    function (e) {
                        alert(e);
                    },
                    null
                );
            });
    
            Sys.Services.ProfileService.load(null, function (r) {
                $("#res").append("<br/>");
                $("#res").append(Sys.Services.ProfileService.properties.LastVisit.toString());
                $("#res").append("<br/>");
            }, function (m) {
                $("#res").append(m.get_message());
            }, null);
    
        });
    </script>
    
    <asp:ScriptManager runat="server" ID="sm">
        <AuthenticationService />
        <ProfileService />
        <RoleService />
    </asp:ScriptManager>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for the ambiguous title; but I don't now how to describe it different.
Sorry if this is stupid question, but I'm new to MATLAB. I have a
sorry for lamer question, but I really could not found subject. I have a
Sorry about the really ambiguous question, I really have no idea how to word
I'm sorry for ambiguous title, but this question is hard for me to put
Sorry gals & guys for a potentially dumb question but I have been looking
Sorry for the ambiguous title but I'm doing the following to write a simple
Sorry for question but I can't find answer anywhere on internet. I couldn't find
Sorry for this simple question, but I can't solve it... There is an example:
Sorry, I know this question is easy, but I don't know how to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.