在过去的项目中,我试图在格里高利日期保存我的时间格式,并在应用程序的逻辑层中将格里高利日期转换为波斯语,但我厌倦了这样做.
我需要在sql server中使用波斯语格式保存和恢复日期时间而不进行任何转换
可以在sql server中键入datetime2存储波斯日期时间吗?
如果没有,存储波斯日期时间的最佳方法是什么?
我使用ASP.NET Core创建了一个示例Web应用程序,以测试Cookie的存储和检索。不幸的是,我无法存储Cookie。
我已经为我的问题阅读了以下问题:
但是不幸的是我没有找到一个好的答案。
我将首先请求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)