C# - Use Request.UrlReferrer When Determining Referrals?

Sep 9, 2010

I came upon an interesting discussion with my team around the use of HttpRequest.UrlReferrer and wanted to solicit feedback from the community. According to the W3C spec:

The Referer[sic] request-header field allows the client to specify, for the server's benefit, the address (URI) of the resource from which the Request-URI was obtained (the"referrer", although the header field is misspelled.) The Referer request-header allows a server to generate lists of back-links to resources for interest, logging, optimized caching, etc. It also allows obsolete or mistyped links to be traced for maintenance. The Referer field MUST NOT be sent if the Request-URI was obtained from a source that does not have its own URI, such as input from the user keyboard.as input from the user keyboard.

The Request.UrlReferrer object does the work of converting referral strings that contain well formed URIs to an object with properties on every request. According to our logs there are requests that come in that contain invalid data in the referral such as:

localhost
app:/BeamBackTest.swf
app:/multtiple.swf
app:/AFriendFeed.swf
ALToolBar
app:/index.html
mhtml:file://C:Documents+and+SettingsUserDesktoporacleWhat+is+a+View+in+Oracle+-+Stack+Overflow.mht

Using Request.UrlReferrer would mean the above cases would be NULL. Is it better to discard the invalid data based on the W3C spec by using Request.UrlReferrer or preserve it by using Request.ServerVariables["HTTP_REFERER"] even though the data may be interesting, but potentially useless.

View 2 Replies


Similar Messages:

Request.UrlReferrer Is Null - How To Set UrlReferrer

Feb 15, 2011

in my web application Request.UrlReferrer is null. how can i set UrlReferrer ?

View 1 Replies

Security :: Authenticate Users By Request.UrlReferrer?

Sep 25, 2010

I am working on an app where users are only allowed access if they click through from certain URLs. I.e. I need to authenticate by using the referral url and I am using
Request.UrlReferrer to achieve this.

I am guessing that the Request.UrlReferrer can be tampered with by malicious users to gain access...

View 3 Replies

Web Forms :: Page.Request.UrlReferrer Not Working?

Nov 24, 2010

What I am trying to solve here is to check for what is previous page's url and compare it. If it is login.aspx then I want to display an WelcomeNote() message. Any help would be deeply appreciated. Here's the codes.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.UrlReferrer IsNot Nothing Then

View 4 Replies

Security :: Request.UrlReferrer Does Not Work In Internet Explorer?

Apr 25, 2010

i have a problem in my asp application . Im trying to protect the path for my application using this code :

Uri t = Request.UrlReferrer;

View 10 Replies

Configuration :: Migrating The Request.UrlReferrer.ToString() To The Web.config File

Jan 10, 2011

I have the following code in 'main.cs' file where I am checking for a condition

protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form.Get("task") != null && Request.Form.Get("postToURL") != null &&
Request.UrlReferrer.ToString().Substring(0, 31).Equals("http://cs.astra.co.in:4040"))
{
ASCIIEncoding encoding = new ASCIIEncoding();
<SO ON>

Instead of checking for the URL [URL] in 'main.cs', Can I check for the same condition in the 'web.config' file ? If so, How can I do that ?? Is there any way to transfer the part -- Request.UrlReferrer.ToString().Substring(0, 31).Equals[URL] -- into the 'web.config' !!

[Code]....

View 1 Replies

C# - Use Request.UrlReferrer And When Request.ServerVariables["HTTP_REFERER"]?

Aug 25, 2010

Both returns the incoming url, Just to know When to use Request.UrlReferrer and when Request.ServerVariables["HTTP_REFERER"] and why?Currently, in one of my application Urlreferrer is working in my local machine but its not working when went live?Additionally, its most appreciable if anyone can guide any alternative of both Urlreferrer and HTTP_REFERRER?

View 1 Replies

How To Get Querystring From URLReferrer

Mar 25, 2011

I am trying to get the QueryString value like this Request.QueryString("SYSTEM") from a UrlReferrer. I see i can use this Request.UrlReferrer.Query() but it doesn't allow me to specify the exact parameter I could parse the Query() value, but I want to know if it is possible to do something like this Request.UrlReferrer.QueryString("SYSTEM")

View 1 Replies

UrlReferrer Is Always NULL?

Apr 29, 2010

Here's the scenario, we've built a url shortener (that we use only to shorten urls for Twitter to our website), and we also track the number of times a url has been clicked. So, for example.. the url might be something like "http://ourshortdomain.com/x9Mr"

Now, in many cases, we see as many as 1000 or 2000 clicks per shortened url, but the referrer is almost always null. How can this be, if the only place we're handing out that shortened url is on Twitter? Shouldn't all the url referrers be coming from Twitter?...

View 1 Replies

Know Previous URL Without Using URLReferrer?

Sep 16, 2010

I am developing a .net website using Visual Studio 2008.

Now this webpage should be open only from link available on other website. User should not be able to type the URL directly in browser and should not be able to open this way directly. When user logs in to other website, there is a link for my website and when user clicks on that link, then only my website should be opened up.

Now, I can not use "Request.UrlReferrer" because it is not 100% correct way as there are many ways that URLReferrer can be blocked by browser or by some antivirus or etc, so I cannot use URLReferrer on my webpage to check from where this page is opened up.

Now my question is what is the best way to check on my webpage that my site has been opened up only from that source? I can also pass some querystring from that website but I am not sure how can I make sure that my webpage opens up only from that source, not when user directly types URL in the browser.

View 5 Replies

Web Forms :: Use UrlReferrer After The User Has Signed-in?

Dec 22, 2010

I want to use UrlReferrer after the user has signed-in.

Can UrlReferrer also refer to a webpage outside of the web project? .. this is not what I want...

View 1 Replies

UrlReferrer Shows A Value With Hyperlink But Null With Response.Redirect

Aug 19, 2010

I am redirecting between two pages, when I use a hyperlink I get the Page1 in the UrlReferrer field, but using Response.Redirect gives it null.

AFAIK both of them act similarly for a redirection.

View 1 Replies

Determining If User Is Log In Or Out?

Mar 9, 2011

I am currently developing a site for my OJT.I have created a login form for my site now I got confused on what to do with this one. I need to identify if the user has been log-in or log-out As the user inputted the exact username and password it will go to this line of codes in which will identity if the user has bees signout or not.

HttpCookie cookie = new HttpCookie("isLog");
cookie.Value = "1";
DateTime dtNow = DateTime.Now;
TimeSpan tsMinute = new TimeSpan(1, 1, 0, 0);
cookie.Expires = dtNow + tsMinute;
Response.Cookies.Add(cookie);
Response.Redirect("manageService.aspx");

And I have this function to determine if the user has been log-in or log-out.

protected Boolean isLog()
{
//String strCookieName = Request.QueryString["cookie"].ToString();
//Grab the cookie
HttpCookie cookie = Request.Cookies["isLog"];
String tmp = cookie.Value.ToString();
return (tmp != null);
}

Now, my problem here is that even though I inputted the correct username and password after reloading the page it will still asked for the user name and password(sends me to the login page). I already set a value for the "isLog" cookie but still it return a wrong info.

View 1 Replies

Determining An Int Or String?

Oct 26, 2010

I have a textbox where the enduser will type either a customer number (int) or a lastname, firstname and press a submit button. I need to programatically determine whether the text field of the textbox can be parsed as an int - and if so, process methodThis or if it is a string, process methodThat.

[Code]....

View 3 Replies

ADO.NET :: Determining Presence Of Specific Value

Feb 10, 2011

I am unsure how to quickly check a set of returned values for a specific value. Given the following:

[Code]....

I then want to check all the returns values in locs for a specific value. I know I could build a foreach loop that would walk through every return data value in locs to see if it matched, but I was hoping to use something simpler.

[Code]....

I tried to search for this already as I am sure it has been asked before, but I apparently lack the proper search keywords.

View 2 Replies

ADO.NET :: Determining The Last Step Completed?

Dec 2, 2010

I have wizards in my app and when the user clicks one, the first thing I check is the "progress status" of the wizard for that user in case he/she has already started the process but never completed it. However, there's always a possibility that he/she might have completed 2 steps in a 5 step wizard.

I read the progress data into a simple List<WizardProgress> which looks like this:

StepID - CompletionDate
1 -- 12/1/2010 18:52:00
2 -- 12/2/2010 18:53:00
3 -- NULL
4 -- NULL
5 -- NULL

What is the best way for me to find the last completed step? It's easy enough to do a foreach but was wondering if there was a better way to do it.

View 1 Replies

Determining The Control That Caused A PostBack

Jul 16, 2010

can I retrieve the name that caused a postback? (VB.NET)

View 5 Replies

Determining The Number Of Days Between A Period?

Jul 21, 2010

dear all. First and foremost the format of my dates are as follows (MM/DD/YYYY)

I have date 1 as 02/01/2007

I have date 2 as 02/07/2009

I would like to determine the number of days between those dates.

View 7 Replies

JQuery :: Determining If A Width Is Toggled On A Div?

Aug 11, 2010

I need to test to if the div is toggled to hide. if it is not hidden I want to toggle it again ( slides left ). when they click the view report button on the Report Viewer control.

But I'm not sure how to find it's toggle values ( whether it's hidden )? ideas?

toggle click function

[Code]....

tried this and doesnt work

[Code]....

View 1 Replies

Web Forms :: Determining User Agent From A Collection?

Aug 19, 2010

I am currently using Request.Useragent.Contains("string1") and if string1 matches with my useragent i am writing it on to the page, now I have to check with a collection ( array or list or ..) which contains {"string1","string2","string3"} and Response.write the useragent if the Request.useragent contains any of the strings collection (string 1,2,3). I am unable to detemine this and if i use a list or array, i am getting a "cannot convert from string[] to string" exception when i use it with Request.Useragent.Contains.

If there is a better way of achieving this, let me know. Its important.

View 2 Replies

Determining Selected State Of JQuery Buttons?

Jun 1, 2010

I've got two radio buttons in a .net page which are being transformed to jQuery buttons a la [URL]

When the page is loaded I have button 2 as checked. When clicking the buttons I'm firing the postback event. Problem is you can click on that button that is selected by default on the initial load i.e. Button 2, the postback is fired but the event handler isn't called in the .net code behind because the radio button is already classed as selected (and in normal circumstances wouldn't allow the postback to fire).

To get around this I've added the e.PreventDefault() method BUT this is causing issues when Button 1 is clicked because before the click handler is called the button is set to selected. Therefore, in every case in the following code e.PreventDefault() is called:

[Code]....

What is the best way for me to load the page and effectively be able to do the following: 'If rbReceivable is checked then don't do anything otherwise do a postback.'

View 2 Replies

MVC :: Determining If There Is Content In A ContentPlaceHolder When Using Html.RenderPartial

Sep 17, 2010

What I'm trying to do is use one master page with two different layouts. Currently we have a "master" master page that has all the common elements and two master pages that use it for the two different layouts. This gives us 3 master pages and there's developer confustion and it is a bit of a hassle to keep them consistent. What I'd like to do instead is say "if there's anything in the MainContent ContentPlaceHolder, show the single column layout, otherwise show the two column layout".

From what I've read you're supposed to be able to do this by using something like the following:

[Code]....

But this.MainContent.Controls.Count retuns zero when the ContentPlaceHolder uses Html.RenderPartial. For example, this works fine:

[Code]....

This causes this.MainContent.Controls.Count to return 1. If I remove MainContent from the view, it returns 0, as expected. However, if I do this:

[Code]....

Then this.MainContent.Controls.Count returns zero.

View 2 Replies

Determining Which Button Caused The Postback In An UpdatePanel?

Oct 18, 2010

In Page_Load, Request["__EVENTTARGET"] is an empty string.IS there some way I can find out which button triggered the postback before hitting the buttons event handler

View 2 Replies

Security :: Determining 'role' Of Logged In User?

Dec 8, 2010

I am trying to create a web application that shows a list of events for different users. I have 2 different user 'roles': admin and member.

Is there a way of getting the current logged in users role? i have tried:

[Code]....

But it doesnt seem to be catching the certain user types, it always shows all of the events.

View 4 Replies

C# - Determining The Availability Of Sufficient Memory For An Operation?

Oct 3, 2010

Can we Determine the availability of sufficient memory for an operation? if yes, then how can?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved