小编Ahm*_*jad的帖子

如何在SQL Server中保存波斯日期时间?

在过去的项目中,我试图在格里高利日期保存我的时间格式,并在应用程序的逻辑层中将格里高利日期转换为波斯语,但我厌倦了这样做.

我需要在sql server中使用波斯语格式保存和恢复日期时间而不进行任何转换

可以在sql server中键入datetime2存储波斯日期时间吗?

如果没有,存储波斯日期时间的最佳方法是什么?

.net sql-server

3
推荐指数
1
解决办法
1231
查看次数

如何使用ASP.NET Core 2.0存储和还原Cookie?

我使用ASP.NET Core创建了一个示例Web应用程序,以测试Cookie的存储和检索。不幸的是,我无法存储Cookie。

我已经为我的问题阅读了以下问题:

ASP.NET Core rc2中的Cookie

使用ASP.NET Core创建cookie

Cookies和ASP.NET Core

但是不幸的是我没有找到一个好的答案。

我将首先请求IndexA操作来存储cookie。该代码运行无任何错误,但是当我请求IndexB操作时。找不到指定的值

这是IndexA动作:

public IActionResult IndexA()
{
   Response.Cookies.Append("mykey", "myvalue",
    new CookieOptions()
    {
        Expires = DateTime.Now.AddMinutes(10)
    });
  return View();
}
Run Code Online (Sandbox Code Playgroud)

这是IndexB操作:

public IActionResult IndexB()
{
   var cookie = Request.Cookies["mykey"];
   return View();
}
Run Code Online (Sandbox Code Playgroud)

这是启动类:

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection …
Run Code Online (Sandbox Code Playgroud)

c# cookies asp.net-core asp.net-core-2.0

2
推荐指数
1
解决办法
3616
查看次数

标签 统计

.net ×1

asp.net-core ×1

asp.net-core-2.0 ×1

c# ×1

cookies ×1

sql-server ×1