Call the previous page on the current page?

 Hi Friends,

I have a login page with a register button. There are other two pages(x and y) and on the other two pages there is a login button which direct the user to the login page. I need some code on the login page and the register button which will tell from which of the two pages(x and y) the login was called.

 

Thanks in Advance

 Sushim
 

0
Sushimdudi
11/25/2008 3:07:13 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

10 Replies
764 Views

Similar Articles

[PageSpeed] 15

 you can get the calling page by using this

 HttpContext.Current.Request.UrlReferrer

 

0
GillouX
11/25/2008 3:29:55 PM

 Can you please explain me this a bit? What it will do?

Thanks 

0
Sushimdudi
11/25/2008 3:36:02 PM

 on the page load of the login page

if you make this

string mycallingpage = HttpContext.Current.Request.UrlReferrer.ToString();

 

mycallingpage contains the page which called your login page

0
GillouX
11/25/2008 3:38:50 PM

So, mycallingpage will capture the URL of the pages ?

0
Sushimdudi
11/25/2008 3:42:44 PM

 yes just test it and you will see


 

and make Reponse.write(myCallingpage); in the page load

 

go on the other page and click to be redirect on the login page

0
GillouX
11/25/2008 3:48:20 PM

 yes

0
GillouX
11/25/2008 3:48:54 PM

 Is there any other way out in which we can capture the login link on the previous page?

 Thanks

Sushim
 

0
Sushimdudi
11/25/2008 4:00:11 PM

 why not use this solution ?

0
GillouX
11/25/2008 4:14:26 PM

 I am using this:

    Dim mycallingpage As String
        mycallingpage = HttpContext.Current.Request.UrlReferrer.ToString()
        If mycallingpage = TimssSettings.NamedPages("Home") & "?tabname=" & TimssSettings.NamedPages("Membership") Then
        Session("member") = True
        Else
        If mycallingpage = TimssSettings.NamedPages("Home") & "?tabname=" & TimssSettings.NamedPages("ShoppingCart") Then
            Session("shopping") = True
        End If

 but its not working. I want to create session if the user is coming from the 'Membership' or 'Shopping' page. No problem with the URLs.

 

Can you help me with it?

 

Sushim 

0
Sushimdudi
11/25/2008 4:44:00 PM

 HttpContext.Current.Request.UrlReferrer.ToString() will give you as string the full url of the calling page

 

so if you are on http://localhost/dd/hello.aspx and you click on a button which redirects to http://localhost/dd/login.aspx

HttpContext.Current.Request.UrlReferrer.ToString() in the pageload of the login.aspx will give you  http://localhost/dd/hello.aspx

that's all it does

 if you need to check parameter in the url, use Request("YourParameter") and test the value

maybe you could explain what is it that you want to do .... 

what is this  TimssSettings.NamedPages ?

0
GillouX
11/25/2008 5:00:34 PM
Reply:

Similar Artilces:

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: http://msdn2.microsoft.com/en-us/library/ms178139.aspxAlso: http://msdn2.microsoft.com/en-us/library/ms178140.aspx might ...

In a web page(c#), I want to call another page and come back to next instruction of calling page
In a web page(c#), I want to call another page and come back to next instruction of calling page. Called page have no web item , it has only c# codes. after executing of this page (by IExplore), I want the remaining lines of calling page to be executed. How can I do that? What are you trying to do? What is the second page accomplishing? Will the first page stay open and the second page closes? You might be able to use WebRequest and WebResponse to do what you want. Hey bro, since you say that the called page has no web items, why dont you put the code in the called pa...

Page current page called from!
Can I retreive the page that called the current page in asp.net using c#.  I took a jsp class a few years back and use a http header call method type thing.  Anything similar in asp.net. stwenterOff the top of my head.... Hi, I think you're looking for this: HttpRequest.UrlReferrer Property. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

how to open a web page in form of a popup web page
Hello, I have two web pages, let say. Page A : With a Button on it. PAge B: with some info. Now I need to: When I click on the Button of page A.Page B must open in a pop up window.  I can do this but problem is this when I clicked on the button for first time it does not show me any thing and when I clicked on the button for second time then It shows me Page B .My code is as follow:  1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if (!this.Page.IsPostBack) 4 { 5 6 } 7 else 8...

if page = current page redirect to other page
 hi ppl.. i wan to redirect my page to another page once read the page display is not the correct page. For example. once it reads the page is page1.aspx it will automatically redirect to page2.aspx  In your page load you can do the following: if(Request.Url.Contains("page1.aspx") { Response.Redirect("~/page2.aspx"); }    i tried but if(Request.Url.contains ... url does not have contains .. i am using C#i tried Request.Url.Equals ... also not working.. ...

All web pages hang on web server when one of the web pages calls a run away sql query
Hi: We have a Windows 2003 dedicated web server running the .NET Frameworks 1.0 and 2.0.  We have a SQL Server cluster running SQL Server 2000.  Unfortunately, we do not have a test environment.  I have 2 .NET web sites in production.  My coworker has a voting .NET web page using AJAX on the same server.  The coworker wrote a query that was not indexing properly and when the page fired the query...the cluster went to almost 100% utilization.  My two web pages would hang and show a blank white page on the default.aspx.  Neither of m...

A page can have only one server-side Form tag
I have a web user control in my web page.  The user control (ascx) consist of a text box and button. The web page consist of text boxes and buttons also.  Both pages have form tags with runat=server.  When I run the web page it comes up with the error "A page can have only one server-side Form tag." Both the user control and web page need the form tag with runat=server.  Is there a way I can code these pages where there won't be a conflict between the web user control and the web page? Thanks   JohnMo wrote:Both the user control and web page need the form tag wit...

DataPager, ListView, UrlRewritingNet, returning to the previous current page from the details page i.e. page 4
Hello,Not sure what to do here.If a user is viewing records in a listview control with multiple pages, they can select a record, which takes them to a details page, displaying the complete information about the record.  If they are on page 4 of the returned records, I would like them to be able to return to that same page when clicking on the web browsers back button.Is this possible?I have looked at saving the current page of the DataPager in the ViewState and Session .The pages are dynamic, created in the code behind page, and the urls are rewriten using UrlRewritingNet.Thanks Matt ...

How to determine whether data is coming from previous page or withing the current page in Cross Page Posting?
Hi everyone,My problem is:I'm using a DataGrid in (page2.aspx) to display the search result for which I'm collecting all the search criteria from previous page(page1.aspx). Till now the task is easy. But in the second page(page2.aspx) there are some other buttons and when I'm trying to invoke methods of those button controls of page2.aspx  an error is displaying i.e. "Object reference not set to an instance of an object" and it is pointing to the code where I'm collecting data from page1.aspx. Also I'm using Masterpage concept. How to separate codes fo...

How to include another .NET page in your current page ?
Hello, Very simple question how do you include another .NET page in another ? Like say a include=test.aspx or something. I don't think it is possible and if it is, please someone show me some example code. What you can do is create user controls (*.ascx) and dynamically include them. On your page you can set a PlaceHolder control and in your code behind you could attach a user control to it PlaceHolderControlOnPage.Controls.Add(LoadControl("test.ascx")) Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answ...

When Press F5 in my web page, it is making fresh call to the page and IsPostBack is false though after many click on button on same page
HI,  I am Using .net 3.5 and vs 2008. In my project there is a Master page also. Actually my problem is. when navigate to the Page say "Home.aspx",  IsPostback is false and relevant code is executed. After that Button1 is clicked in home page, this time IsPostback is true and corresponding code and Button1_click code is executed. In this situation F5 is pressed, as per the aspx lifecycle IspostBack is true and Button1_click must be executed. but in my case it is pretty diffrent, i.e IsPostback  is false and page is loading freshly as firstime request to the...

Which page has called a page
Hello, Is a page able to know which page has called it ? If Page_A and Page_B can call Page_C, I would want to know during Page_Load of Page_C if it is Page_A or Page_B which is the calling page ? Thank's Alain You could try using Request.UrlReferrer. This will give you the complete url, type: http://localhost/NetSamples/Employees.aspx To strip away everything unecessary like Querystrings etc. you could use something like this: Dim strReferrer As String = Request.UrlReferrer.ToString Dim intStart As Int32 = strReferrer.LastIndexOf("/") + 1 ...

how to know the calling page from called page.
hi, i need to know how to get the calling page from the called page even there is no post back has been done. Look at the ServerVariables, in particular the Referer i am having the linkbutton in the previous page called page1. while clicking the button the page is redirect to the current page called page2. now i want to know the name or url of the page1. how can i do???? As I already said.... HttpContext.Current.Request.ServerVariables("HTTP_REFERER") Thank You so much... it works very well.......

Web resources about - Call the previous page on the current page? - asp.net.web-forms

List of Presidents of the United States by previous experience - Wikipedia, the free encyclopedia
Although many paths may lead to the Presidency of the United States , the most common job experience, occupation or profession of U.S. presidents ...

Lish.com comes out of beta with 2x visitors and 3x engagement of Payvment’s previous f-commerce app
... and best practices for social shopping. Lish.com, which launched in beta in August , receives twice as many daily visitors as Payvment’s previous ...

CET and HadCRUT v3 vs previous SCL (since 1854) - Flickr - Photo Sharing!
Graph of previous solar cycle length (X axis) vs averaged annual temperature anomaly during the following solar cycle (Y axis). CET has only ...

Wheat and chaff: Arabian Gulf's previous attempts of cultivating crop
Concerns about food security have prompted trials of wheat cultivation. But previous attempts to grow the crop in the region have not fared well. ...

China set for 20 gigawatts of solar after first quarter splurge doubles previous year
Solar capacity in China doubled in the first quarter, putting the world's largest market on track to exceed its goals for the year, according ...

Vince Colosimo caught twice driving on a previous suspension
He's played a police officer on more than one occasion but this time Vince Colosimo has found himself on the wrong side of the law.


Duncan Gay's licence plan for cyclists goes against previous departmental advice
Forcing cyclists to take out a licence, as proposed by Duncan Gay, would put ''substantial'' costs on families and probably be ineffective in ...

Two Mr Fluffy homes sell for well below their previous worth
Two Mr Fluffy homes that sold recently for well below their previous worth show the extent to which the asbestos crisis is affecting house values. ...

Previous form counts for nothing in Asian Cup, says Socceroos defender Jason Davidson
He might have been one of Australia's best performers at the 2014 World Cup, but talented defender Jason Davidson concedes that will count for ...

Resources last updated: 12/30/2015 8:06:56 AM