Request.ServerVariables(HTTP_REFERER)&数据提交时注意的问题
2013-10-07 11:21
531 查看
来自:/article/4730847.html 特此感谢
作用:得到访问的上一页的Url
Request.ServerVariables["HTTP_REFERER"]可用的情况
1.直接用<a href>
2.用Submit或<input type=image>提交的表单(POST or GET)
3.使用Jscript提交的表单(POST or GET)
Request.ServerVariables["HTTP_REFERER"]不可用的情况
1.从收藏夹链接
2.单击'主页'或者自定义的地址
3.利用Jscript的location.href or location.replace()
4.在浏览器直接输入地址
5.<%Response.Redirect%>
6.<%Response.AddHeader%>或<meta http-equiv=refresh>转向
7.用XML加载地址
Asp.net 示例
public partial class FileManage_EditSoftWare : System.Web.UI.Page
{
private static string strLastPageUrl = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
strLastPageUrl = Request.ServerVariables["HTTP_REFERER"].ToString();
}
}
//返回
protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect(strLastPageUrl);
}
}
作用:得到访问的上一页的Url
Request.ServerVariables["HTTP_REFERER"]可用的情况
1.直接用<a href>
2.用Submit或<input type=image>提交的表单(POST or GET)
3.使用Jscript提交的表单(POST or GET)
Request.ServerVariables["HTTP_REFERER"]不可用的情况
1.从收藏夹链接
2.单击'主页'或者自定义的地址
3.利用Jscript的location.href or location.replace()
4.在浏览器直接输入地址
5.<%Response.Redirect%>
6.<%Response.AddHeader%>或<meta http-equiv=refresh>转向
7.用XML加载地址
Asp.net 示例
public partial class FileManage_EditSoftWare : System.Web.UI.Page
{
private static string strLastPageUrl = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
strLastPageUrl = Request.ServerVariables["HTTP_REFERER"].ToString();
}
}
//返回
protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect(strLastPageUrl);
}
}
相关文章推荐
- Request.ServerVariables("HTTP_REFERER")的工作方式
- Request.ServerVariables(HTTP_REFERER) 获取方式注意
- Request.ServerVariables("HTTP_REFERER")不能使用
- Request.ServerVariables("HTTP_REFERER")的工作方式
- ASP 使用 Request.ServerVariables(HTTP_REFERER) 方法获取请求页面地址的注意事项
- 关于 Request.ServerVariables("HTTP_REFERER") 运行时会出错的原因
- Request.ServerVariables(”HTTP_REFERER”)防止下载盗链
- Request.ServerVariables(HTTP_REFERER)
- :Request.ServerVariables("HTTP_REFERER")的工作方式
- HTTP_REFERER是什么 与 Request.ServerVariables("HTTP_REFERER")的用法(防外连接)
- Request.ServerVariables("HTTP_X_FORWARDED_FOR")
- 取得浏览器当前语言 Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
- spring mvc 数据绑定问题 提交表单提示HTTP status 400, The request sent by the client was syntactically incorrect
- Request.ServerVariables(HTTP_REFERER) 适用和不适用的情况
- Request.ServerVariables(”HTTP_REFERER”)防止下载盗链
- 当前地址: <a href='"+Request.ServerVariables("HTTP_HOST").Item+"/a.asp?id="+sId+"'>点击查看</a>";
- Request.ServerVariables("HTTP_X_FORWARDED_FOR")
- Request.ServerVariables(HTTP_REFERER)
- Request.ServerVariables("HTTP_USER_AGENT")
- 20110215 学习记录2:表单中的get和post区别 & 使用 HttpWebRequest 向网站提交数据