Getting Referrer Url On DLL?

Mar 21, 2011

Am building an dll which contains a function called geturl(Uri myuri), Uri as parameter. Basically i want to get the url of the page which calls this function(function is located on DLL). I have used the below code, but am not sure the page url can be overrided //In default.aspx //class declaration myclass mc = new myclass(); Uri ur = Request.Url; string str = mc.geturl(ur) //In DLL public string geturl(Uri myuri) { Uri MyUrl = myuri; string requrl = MyUrl.AbsoluteUri.ToString(); return requrl; } So my question is can the Uri on the default.aspx be assigned with custom url as [URL] instead of http://localhost/test/default.aspx

View 4 Replies


Similar Messages:

Web Forms :: Restrict Page To Certain Referrer?

Mar 30, 2010

I have a page which I only want to be accessable via a certain other page.Example, PageTwo.aspx can only be accessed via PageOne.aspxAll other referrers redirect to asp.netCan this be done in asp?

View 2 Replies

C# - Getting Only The Referrer Page Not Complete Address?

Jan 22, 2010

I am using C#. Below is my sample code.

private void Page_Load(object sender, System.EventArgs e)
{
string str = Request.UrlReferrer.ToString();
Label1.Text = str;
}

The result in Label1.Text is http://localhost:82/data/WebForm1.aspx.Now I want the result "WebForm1.aspx" in Label1.Text

View 2 Replies

Response.Redirect Not Populating Url Referrer?

Sep 17, 2010

I feel like i've done this a ton of times, but i can't for the life of me figure out what is going wrong.

Default.aspx:

protected void Page_Load(object sender, EventArgs e)
{
var r1 = Request.UrlReferrer; // null
var r2 = Request.ServerVariables["HTTP_REFERRER"]; // null
}

SingleSignOn.aspx:

protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect("/");
}

If i type "/SingleSignOn.aspx" in the URL, it redirects to Default.aspx, but the referrer is null.

What am i missing here?

What im trying to do (this is a simplified example), is on any page, i will have some JavaScript to do the following:

window.location.replace('~/SingleSignOn.aspx');

Which, you guessed it, signs the user in, and redirects to the homepage.

But i need to build logic into that JavaScript to not redirect to the SingleSignOn.aspx page if we just came from there.

Does the referrer only get populated by actual link user clicks?

How can i do this then? I don't want to use QueryString because i dont want to see that in the URL.

View 2 Replies

C# - Detecting If Referrer Was From A 301 Permanent Redirect?

Jul 8, 2010

I am doing a 301 permanent redirect from an old server to a new server. When the new server's page is hit I want to be able to determine whether the user comes from the old site and then react differently, i.e. instruct user to re-book mark the new page.

View 2 Replies

Creating A Mock URL Referrer In MVC For Unit Testing?

Feb 10, 2010

I'm currently testing my application and am stuck on trying to figure out how to create a custom fake URL referrer. I've tried to hard code it, but am getting an error that it is read-only. Here is what I've tried so far:

fakeController.HttpContext.Request.UrlReferrer.AbsolutePath = "http://www.yahoo.com";
as well as,
fakeController.Request.UrlReferrer = "http://www.yahoo.com";

I've searched the web for some ideas on how to create a fake/mock URL referrer for my fake controller, but have had no luck.

Note: I'm using Visual Studios built-in unit testing facilities.

UPDATE:

I would be more than willing to use any other unit testing system outside of Visual Studio, unfortunately here at my work we are only allowed to use Visual Studio's built-in system, so I gotta work with what I've got.

View 3 Replies

Restrict Access To Web Site Based On Referrer, Cookies Or Something Else?

Feb 22, 2010

We have a scenario whereby we are hosting an ASP.NET MVC web site on behalf of someone else.The customer in this case wants us to restrict access to the web site, to those users who have logged in to their main portal. They should then only be able to get to our web site via a link from that portal.At this point I'm not yet sure what technology or authentication mechanism the 3rd party are using but just wanted to clarify what the possible options might be.If we call our hosted site B, and their portal web site A,as I see it we could:Check the referrer for all requests to B, unless they've come from A they can't get inCheck for a specific cookie (assuming A uses cookies)

View 2 Replies

State Management :: Get The Calling Url Referrer From A Secure Site?

Jul 14, 2010

I need to get the calling page url referrer and host name. I works for me if the calling pages are within the same network. When a page is called from an internal site that are outside of my network, I got the following error:

Object reference not set to an instance of an object.

It failed on this line:

string userURL = Request.UrlReferrer.ToString();

View 1 Replies

C# - How To Simulate Http Request Using WatiN With Specific HTTP Referrer And Query String

Dec 6, 2010

When I use WatiN to go to a specific web page, how can I fake the HTTP referrer with a query string (i.e. request is from google search with query string q=search_term)? So I can verify that the response header has the 301 redirect for specific referrer URL.

View 2 Replies

How To Retrieve The Referrer Page Url Once A Custom Error Page Is Returned

Sep 9, 2010

I'd like to capture the http referrer url following the rendering of a custom error page.I have this set in my web.config

<customErrors mode="On">
<error statusCode="500" redirect="/StaticError.aspx" />
</customErrors>

In the OnLoad(EventArgs e) event -- I'm trying to do this, but it appears to be too late.this.txtReferrer.Text = Request.UrlReferrer.ToString();Is it possible to capture the referrer url?

View 1 Replies







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