如何在asp.net中实现用户单击和重定向 [英] How to implement the user click and redirection in asp.net
本文介绍了如何在asp.net中实现用户单击和重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了一个跟踪用户IP并将其存储在DB中的代码,以便以后使用.
我无法开始如何在链接单击上实现它,以便获得用户点击数据并将其插入数据库以及在link
I have written a code that tracks the User IP and stores it in DB so that i can use it later.
I cannot get the start ahead on how can i implement it on link click so that i get the user click data and insert it in DB as well as Do a redirection on link
推荐答案
上进行重定向
你好,
如下所示,将您的代码写入linkbuttonclick事件方法.
在ASPX页面中,编写以下代码
Hi,
Write your code into the linkbuttonclick event method as given below.
in ASPX page write below code
<asp:LinkButton Id="LnkBtn" Text="Save Details" OnClick="LnkBtn_Click" runat="server"/>
并在文件后面的代码中编写以下代码
and write below code in code behind file
protected void LnkBtn_Click(Object sender, EventArgs e)
{
//user below code to get the client details
//Request.ServerVariables["REMOTE_ADDR"];
//Write code to save the details into database
}
希望对您有帮助
Hope this will help you
这篇关于如何在asp.net中实现用户单击和重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文