如何使用c#在asp.net中显示最近查看的项目 [英] how to show the recent viewed items in asp.net using c#
本文介绍了如何使用c#在asp.net中显示最近查看的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是srikanth。
实际上我只是想用c#在asp.net中显示最近查看的项目。
can关于这个问题,请帮帮我。
谢谢你的问候
Srikanth.J
解决方案
将Global .asax文件添加到您的项目中
无效Application_Start(对象发件人,EventArgs e)
{
//在应用程序启动时运行的代码
应用程序[k] = 0;
}
void Session_Start(对象发送者,EventArgs e)
{
//新会话启动时运行的代码
Application.Lock();
应用程序[v] =((int)应用程序[k] + 1);
Application.UnLock();
}
在你的页面中使用cookies
,
Label1 .Text = Convert .ToString(Application [k]);
在谷歌上找到这个 [ ^ ]
Hi this is srikanth.
Actually i just want to show the recent viewed items in asp.net using c#.
can you please help me out regarding this querry.
Thanks With Regards
Srikanth.J
解决方案
Add Global .asax file into your project
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application["k"] = 0;
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
Application.Lock();
Application ["v"]=((int )Application ["k"]+1);
Application.UnLock();
}
using cookies with this
in your page ,
Label1 .Text =Convert .ToString ( Application ["k"]);
Found this on google[^]
这篇关于如何使用c#在asp.net中显示最近查看的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文