62,254
社区成员
发帖
与我相关
我的任务
分享
if (window.location.toString().indexOf(".htm", 0) > 0){
var yourhtm_url = "your_html.aspx?htmurl=" + escape(window.location.toString()) + "&ref=" + escape(document.referrer.toString());
if (window.location.toString().indexOf(".htm", 0) > 0)
{
yourAjaxRequest(yourhtm_url, null);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Text;
using System.Net;
using System.IO;
using MyData_object;
using System.Configuration;
using System.Web.Configuration;
namespace yourWeb
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class your_html : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try
{
if (context.Request.QueryString["htmurl"] != null)
{
try
{
HttpRequest request = context.Request;
string UrlReferrer = "";
string UrlReferrerHost = "";
if (context.Request.QueryString["ref"] != null && context.Request.QueryString["ref"]!="")
{
UrlReferrer = context.Request.QueryString["ref"].ToString();
UrlReferrerHost = UrlReferrer.Substring(UrlReferrer.IndexOf("//") + 2, UrlReferrer.IndexOf("/", UrlReferrer.IndexOf("//") + 2) - UrlReferrer.IndexOf("//") - 2);
}
//穿过代理服务器取远程用户真实IP地址:
string str_Address = "";
//if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
// str_Address = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
//else
//{
//str = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
str_Address = HttpContext.Current.Request.UserHostAddress;
//}
HttpBrowserCapabilities bc = new HttpBrowserCapabilities();
bc = HttpContext.Current.Request.Browser;
string Xt = bc.Platform;
string Browser = bc.Type;
string url = context.Request.QueryString["htmurl"].ToString().Replace("http://" + context.Request.Url.Authority.ToString(), "");
string zzm = "";
Boolean zz = false;
if (Global.ODCm != null)
{
Global.ODCm.Parameters["@Address"].Value = str_Address;
Global.ODCm.Parameters["@url"].Value = url;
Global.ODCm.Parameters["@UrlRefHost"].Value = UrlReferrerHost;
Global.ODCm.Parameters["@UrlRef"].Value = UrlReferrer;
Global.ODCm.Parameters["@Xt"].Value = Xt;
Global.ODCm.Parameters["@Browser"].Value = Browser;
Global.ODCm.Parameters["@zz"].Value = zz;
Global.ODCm.Parameters["@zzName"].Value = zzm;
Global.ODCm.ExecuteNonQuery();
}
}
catch
{
}
}
}
catch
{
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
Uri MyUrl = Request.UrlReferrer;
Response.Write("Referrer URL Port: " + Server.HtmlEncode(MyUrl.Port.ToString()) + "<br>");
Response.Write("Referrer URL Protocol: " + Server.HtmlEncode(MyUrl.Scheme) + "<br>");