Does anyone know if there is a way to capture the search phrase used to get to your site? Do the search engines forward that information in any header values?
I have looked through all of the Request.ServerVariables and have not been able to find anything to do with the origin of the user (other than HTTP_REFERER).
I can see some anonymous information in Google Analytics but I am wanting to bind this information to user records upon account creation.
Any help is appreciated.
Yes - UrlReferrer is where you would have to look. But as google search (by default) runs via https it will not send any Url Referrer. So you are out of luck here - sorry (or maybe good for the users ;-) ).
If you get visited by http you could try some fancy approach like:
http://www.codeproject.com/Tips/127681/Get-search-key-word-from-the-referrer-url
If the page before loading your page was the search engine, you can use UrlReferrer to get it and then maybe parse it to get the values
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>");
Hope it helps
Related
I have searched everywhere and I cannot find out how to pass my API key in with my request. I am setup to run from a specific IP address. I keep hitting my limit though. I think I am also hitting my time limits. I will introduce a sleep in my code. Otherwise, is there anything else I can check?? I am using the distance matrix with json output. I have turned on Google Maps API V3. I have a key and have a project. It seems like the service is still treating me like a free customer.
string url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=" +
origin + "&destinations=" + sDestination + "&mode=driving&language=en-EN&sensor=false&units=imperial";
I have also tried two more approaches with my key and I get a denied request from both of them.
string url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=" +
origin + "&destinations=" + sDestination + "&key=mykey&mode=driving&language=en-EN&sensor=false&units=imperial";
and
string url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=" +
origin + "&destinations=" + sDestination + "&key={mykey}&mode=driving&language=en-EN&sensor=false&units=imperial";
I was not sure if the curly braces were required or not. Both of the later lines of code result in request denials.
Looks to me like you just pass the key right in the URL, at least for the regular maps API. Take a look at the "Hello World" example in the documentation. It might work the same for the distance matrix. Have you tried it that way?
I would like to get the exact url that user typed into the browser. Of course I could always use something like Request.Url.ToString() but this does not give me what i want in the following situation:
http://www.mysite.com/rss
With the url above what Request.Url.ToString() would give me is:
http://www.mysite.com/rss/Default.aspx
Does anyone know how to accomplish this?
I have already tried:
Request.Url
Request.RawUrl
this.Request.ServerVariables["CACHE_URL"]
this.Request.ServerVariables["HTTP_URL"]
((HttpWorkerRequest)((IServiceProvider)HttpContext.Current).GetService(typeof(HttpWorkerRequest))).GetServerVariable( "CACHE_URL")
((HttpWorkerRequest)((IServiceProvider)HttpContext.Current).GetService(typeof(HttpWorkerRequest))).GetServerVariable( "HTTP_URL")
Edit: You want the HttpWorkerRequest.GetServerVariable() with the key HTTP_URL or CACHE_URL. Note that the behavior differs between IIS 5 and IIS 6 (see documentation of the keys).
In order to be able to access all server variables (in case you get null), directly access the HttpWorkerRequest:
HttpWorkerRequest workerRequest =
(HttpWorkerRequest)((IServiceProvider)HttpContext.Current)
.GetService(typeof(HttpWorkerRequest));
Remember too that the "exact URL that the user entered" may never be available at the server. Each link in the chain from fingers to server can slightly modify the request.
For example if I type xheo.com into my browser window, IE will be convert to http://www.xheo.com automatically. Then when the request gets to IIS it says to the browser - you really want the default page at http://www.xheo.com/Default.aspx. So the browser responds by asking for the default page.
Same thing happens with HTTP 30x redirect requests. The server will likely only ever see the final request made by the browser.
Try using Request.Url.OriginalString
Might give you the thing you are looking for.
It is possible, you just need to combining a few of the values from the request object to rebuild the exact url entered:
Dim pageUrl As String = String.Format("{0}://{1}{2}",
Request.Url.Scheme,
Request.Url.Host,
Request.RawUrl)
Response.Write(pageUrl)
Entering the address http://yousite.com/?hello returns exactly:
http://yousite.com/?hello
Request.RawUrl
I think is the monkey you are after...
Easiest way to do this is used client-side programming to extract the exact url:
<script language="javascript" type="text/javascript">
document.write (document.location.href);
</script>
I have a site where we use a RadWindow as a confirm-popup.
Why does the popup not show/work on "https", when everything's works fine on "http"?
I can add more code if necessary, but this is the most important, I think. It's where my track ended..
string url = "../Controls/General/ScenarieBeregning/ScenariePopupPage.aspx";
Log.Debug("popup . url: "+url+". "+DateTime.Now);
string script = string.Format(
"radopen('" + url + "?skemaId={0}&redirect={1}','RadWindow1')",
skemaId,
redirect);
ScriptManager.RegisterStartupScript(
Page, typeof(Page), "scenarieConfirmPopUp", script, true);
I tryed adding "https" in url and google this, but with not luck.
Anyone help is much appreciated.
I can share my solution:
string protocol = Request.Url.Scheme; // HTTP eller HTTPS
string url = protocol + "://" + WebConfigConstant.HostAppsetting +"/Controls/General/ScenarieBeregning/ScenariePopupPage.aspx";
Check here
Telerik team :
The behavior that you experience is expected - if one of the pages is
using HTTP and the other - HTTPS, you cannot access objects in one
page from the other. Please note that this issue is not related to the
RadWindow control - you will experience the same behavior if you are
using a standard IFRAME instead. There is no other workaround in such
scenario than to have both pages using the same protocol, otherwise it
would be a major security hole.
I am trying to validate using this parameters:
"openid.mode=check_authentication"<br>
+ "&openid.assoc_handle=" + txtAssocHandle.Text<br>
+ "&openid.response_nonce=" + HttpUtility.UrlEncode(txtNonce.Text)<br>
+ "&openid.op_endpoint=" + txtEndpoint.Text<br>
+ "&openid.sig=" + txtSignature.Text<br>
+ "&openid.signed=mode,identity,return_to";
and it returns
is_valid:false
ns:http://specs.openid.net/auth/2.0
what am I doing wrong here?
the txt fields are being filled with login response values
Your openid.signed argument needs to be exactly what the OP sent to your RP rather than this incomplete hard-coded list of 3 parameters, for one thing. All your arguments should be URL encoded as well, not just your nonce.
There is a lot more to validating an OpenID token than just sending it back to the OP using "dumb mode". What are you trying to do?
Have you considered using an OpenID library? Seriously, getting OpenID right (meaning secure, and interoperable) is a big job. Way bigger than assembling just the right query string. :)
I would like to get the exact url that user typed into the browser. Of course I could always use something like Request.Url.ToString() but this does not give me what i want in the following situation:
http://www.mysite.com/rss
With the url above what Request.Url.ToString() would give me is:
http://www.mysite.com/rss/Default.aspx
Does anyone know how to accomplish this?
I have already tried:
Request.Url
Request.RawUrl
this.Request.ServerVariables["CACHE_URL"]
this.Request.ServerVariables["HTTP_URL"]
((HttpWorkerRequest)((IServiceProvider)HttpContext.Current).GetService(typeof(HttpWorkerRequest))).GetServerVariable( "CACHE_URL")
((HttpWorkerRequest)((IServiceProvider)HttpContext.Current).GetService(typeof(HttpWorkerRequest))).GetServerVariable( "HTTP_URL")
Edit: You want the HttpWorkerRequest.GetServerVariable() with the key HTTP_URL or CACHE_URL. Note that the behavior differs between IIS 5 and IIS 6 (see documentation of the keys).
In order to be able to access all server variables (in case you get null), directly access the HttpWorkerRequest:
HttpWorkerRequest workerRequest =
(HttpWorkerRequest)((IServiceProvider)HttpContext.Current)
.GetService(typeof(HttpWorkerRequest));
Remember too that the "exact URL that the user entered" may never be available at the server. Each link in the chain from fingers to server can slightly modify the request.
For example if I type xheo.com into my browser window, IE will be convert to http://www.xheo.com automatically. Then when the request gets to IIS it says to the browser - you really want the default page at http://www.xheo.com/Default.aspx. So the browser responds by asking for the default page.
Same thing happens with HTTP 30x redirect requests. The server will likely only ever see the final request made by the browser.
Try using Request.Url.OriginalString
Might give you the thing you are looking for.
It is possible, you just need to combining a few of the values from the request object to rebuild the exact url entered:
Dim pageUrl As String = String.Format("{0}://{1}{2}",
Request.Url.Scheme,
Request.Url.Host,
Request.RawUrl)
Response.Write(pageUrl)
Entering the address http://yousite.com/?hello returns exactly:
http://yousite.com/?hello
Request.RawUrl
I think is the monkey you are after...
Easiest way to do this is used client-side programming to extract the exact url:
<script language="javascript" type="text/javascript">
document.write (document.location.href);
</script>