在ASP.NET服务器端保留用户特定的设置

时间:2022-05-26 16:52:05

I'm working on a .NET 3.5 Web Application and I was wondering what would be good way to persist user specific settings (i.e. user preferences) server-side?

我正在研究.NET 3.5 Web应用程序,我想知道在服务器端保留用户特定设置(即用户首选项)的好方法是什么?

Here are the conditions:

以下是条件:

  • It needs to be able to store/retrieve settings based on a User ID
  • 它需要能够根据用户ID存储/检索设置

  • I don't want to use SQL Server or any such DB engine
  • 我不想使用SQL Server或任何此类数据库引擎

  • I don't want to store it in cookies
  • 我不想将它存储在cookie中

Any guidance would be greatly appreciated.

任何指导将不胜感激。

Edit: If it makes any difference, it doesn't have to support a web farm.

编辑:如果它有任何区别,它不必支持Web场。

4 个解决方案

#1


Use the ASP.NET Profile feature for this. See ASP.NET Profile Properties Overview

使用ASP.NET配置文件功能。请参阅ASP.NET配置文件属性概述

#2


If you want to persist data, and you don't want to use a database, then you need to save the data to disk (such as XML). If you're looking for something that isn't local to your server, you could use a SaaS solution that would host your data for you, such as Amazon's S3 service. If you do that, the latency of data retrieval will slow your application down, so you'll want to cache the data.

如果要保留数据,并且不想使用数据库,则需要将数据保存到磁盘(例如XML)。如果您正在寻找服务器不是本地的东西,您可以使用可以为您托管数据的SaaS解决方案,例如亚马逊的S3服务。如果这样做,数据检索的延迟会降低应用程序的速度,因此您需要缓存数据。

#3


Text files (JSON/XML/etc), though security then becomes an associated problem.

文本文件(JSON / XML / etc),虽然安全性然后成为一个相关的问题。

#4


Given those parameters, you could just keep track of your own user preferences XML file on the server.

根据这些参数,您可以在服务器上跟踪自己的用户首选项XML文件。

#1


Use the ASP.NET Profile feature for this. See ASP.NET Profile Properties Overview

使用ASP.NET配置文件功能。请参阅ASP.NET配置文件属性概述

#2


If you want to persist data, and you don't want to use a database, then you need to save the data to disk (such as XML). If you're looking for something that isn't local to your server, you could use a SaaS solution that would host your data for you, such as Amazon's S3 service. If you do that, the latency of data retrieval will slow your application down, so you'll want to cache the data.

如果要保留数据,并且不想使用数据库,则需要将数据保存到磁盘(例如XML)。如果您正在寻找服务器不是本地的东西,您可以使用可以为您托管数据的SaaS解决方案,例如亚马逊的S3服务。如果这样做,数据检索的延迟会降低应用程序的速度,因此您需要缓存数据。

#3


Text files (JSON/XML/etc), though security then becomes an associated problem.

文本文件(JSON / XML / etc),虽然安全性然后成为一个相关的问题。

#4


Given those parameters, you could just keep track of your own user preferences XML file on the server.

根据这些参数,您可以在服务器上跟踪自己的用户首选项XML文件。