在c#中创建的cookie在localhost中运行良好,但在实时服务器上不起作用

时间:2014-02-12 13:32:26

标签: c# cookies

我在C#中创建了cookie,它在localhost中工作得很好,但在实时服务器上不起作用,并且在实时服务器上没有显示cookie ...代码在下面

string currenturl = "/" + countrystate + "/" + city + "/" + HotelName + "?" + HotelIds;
currenturl = currenturl.Replace(" ", "-");

HttpCookie cookiecurrentpath =System.Web.HttpContext.Current.Request.Cookies["CurrentPath"];

if (cookiecurrentpath == null)
{
     cookiecurrentpath = new HttpCookie("CurrentPath");                   
     cookiecurrentpath.Value = currenturl;                  
}

cookiecurrentpath.Expires = DateTime.Now.AddDays(7);
this.ControllerContext.HttpContext.Response.Cookies.Add(cookiecurrentpath);

0 个答案:

没有答案