473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

back in history on aspx page

Hi,
I have a login page and after click on button Login I check username and
password and if it is correct, i want load page, which was there before
Login page. How can I do it? In javascript it is simply

<script language="javascript">window.history.back();</script>

but How can I do it in C# code?

Please help. Thanks Lubos
Nov 16 '05 #1
7 10207
How do you go to the login page? I mean... if I land of secretpage.aspx, how
do you validate the login?

Are you using web.config configuration or FormsAuthentication on each secret
page?

--

Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
-----------------------------------
"Luboš Šlapák" <lu**********@centrum.cz> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
I have a login page and after click on button Login I check username and
password and if it is correct, i want load page, which was there before
Login page. How can I do it? In javascript it is simply

<script language="javascript">window.history.back();</script>

but How can I do it in C# code?

Please help. Thanks Lubos

Nov 16 '05 #2
I don't use web.config, because i don't know how to use it, i have
Login.aspx and when i go to secret page, it is redirect to Login page, where
i validate login information from database. So I need after login redirect
back on secret page.
"Gaurav Vaish" <mD*****************************@nospam.lycos.co m> píše v
diskusním příspěvku news:%2****************@TK2MSFTNGP09.phx.gbl...
How do you go to the login page? I mean... if I land of secretpage.aspx, how do you validate the login?

Are you using web.config configuration or FormsAuthentication on each secret page?

--

Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
-----------------------------------
"Luboš Šlapák" <lu**********@centrum.cz> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
I have a login page and after click on button Login I check username and
password and if it is correct, i want load page, which was there before
Login page. How can I do it? In javascript it is simply

<script language="javascript">window.history.back();</script>

but How can I do it in C# code?

Please help. Thanks Lubos


Nov 16 '05 #3
How does secret page know whether you are logged in or not is what I want to
know...

Ok.. you can do the following:

1. Login.aspx
-> When you jump of the login page, do a:

// First time a user is redirected to the page
if(!IsPostBack)
ViewState["referer"] = Request.ServerVariables["HTTP_REFERER"];
else
// If user is validated, redirect him back.
if(ValidateUser(username, password))
Response.Redirect((string)ViewState["referer"]);
--

Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
-----------------------------------
"Luboš Šlapák" <lu**********@centrum.cz> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
I don't use web.config, because i don't know how to use it, i have
Login.aspx and when i go to secret page, it is redirect to Login page, where i validate login information from database. So I need after login redirect
back on secret page.
"Gaurav Vaish" <mD*****************************@nospam.lycos.co m> píše v
diskusním příspěvku news:%2****************@TK2MSFTNGP09.phx.gbl...
How do you go to the login page? I mean... if I land of secretpage.aspx,

how
do you validate the login?

Are you using web.config configuration or FormsAuthentication on each

secret
page?

--

Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
-----------------------------------
"Luboš Šlapák" <lu**********@centrum.cz> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
I have a login page and after click on button Login I check username and password and if it is correct, i want load page, which was there before Login page. How can I do it? In javascript it is simply

<script language="javascript">window.history.back();</script>

but How can I do it in C# code?

Please help. Thanks Lubos



Nov 16 '05 #4
Hi,
It could be as easy as sending the referer page as a parameter:
you go to secretpage.aspx in the page_load do a check to see if the user is
logged, if not do a redirect to login.aspx?gonext=secretpage.aspx

in this way to know where to go after a succesful logon, you just do a
redirect pointed with the parameter.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Luboš Šlapák" <lu**********@centrum.cz> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
I have a login page and after click on button Login I check username and
password and if it is correct, i want load page, which was there before
Login page. How can I do it? In javascript it is simply

<script language="javascript">window.history.back();</script>

but How can I do it in C# code?

Please help. Thanks Lubos

Nov 16 '05 #5
If you are using ASP.NET forms authentication, the safest way to
redirect is with FormsAuthentication.RedirectFromLoginPage.

--
Scott
http://www.OdeToCode.com

On Thu, 16 Sep 2004 11:47:42 +0200, "Luboš Šlapák"
<lu**********@centrum.cz> wrote:
Hi,
I have a login page and after click on button Login I check username and
password and if it is correct, i want load page, which was there before
Login page. How can I do it? In javascript it is simply

<script language="javascript">window.history.back();</script>

but How can I do it in C# code?

Please help. Thanks Lubos


Nov 16 '05 #6
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:cc********************************@4ax.com...
If you are using ASP.NET forms authentication, the safest way to
redirect is with FormsAuthentication.RedirectFromLoginPage.


That will require web.config modification... loginUrl= etc.

Lubos mentioned that he's not using web.config. Otherwise that's the
cleanest bet.
--

Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
-----------------------------------
Nov 16 '05 #7
I think it would be easier for him to learn how to use web.config then
reimplement forms based authentication with his own code.

--
Scott
http://www.OdeToCode.com
On Thu, 16 Sep 2004 18:36:20 +0530, "Gaurav Vaish"
<mD*****************************@nospam.lycos.co m> wrote:
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:cc********************************@4ax.com.. .
If you are using ASP.NET forms authentication, the safest way to
redirect is with FormsAuthentication.RedirectFromLoginPage.


That will require web.config modification... loginUrl= etc.

Lubos mentioned that he's not using web.config. Otherwise that's the
cleanest bet.


Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: pmelanso | last post by:
Hello, How can I tell if there is a page to go back to in the history or not??? Same with forward??? say something like/// if (there is a page to go back to ) { // DO something }else { }
2
by: Luboš Šlapák | last post by:
Hi, I need (in one function in aspx page) return the WWW browser back to previous page. How can I do it? Thanks
2
by: Frawls | last post by:
Hi Can any one give me some help with this problem please? Here is the scenario: A user submits page 1 which is a web form.
3
by: Michelle A. | last post by:
What is the difference between the two? I have a page "one" with a button using Response.Redirect("pagetwo.asxp") to go to the next page. On page two I have a button using...
4
by: Bratislav Jevtic | last post by:
hi, ASP.NET, framework 1.0, patch 2, Windows 2000 server is this possible: from server side to say "go back" to browser? ------------------- scenario: I've got some page with a list. When...
8
by: moondaddy | last post by:
Is there a way to make the browser move back to the previous page via code behind on the server? The effect would be the same as the user clicking on the browser's back button. Thanks. --...
2
by: ShaneFowlkes | last post by:
I created a couple of quick test pages and to my surprise, these do not work either. When I click "Go Back" on test2.aspx, nothing happens. Ideas?? Surely I must be missing something obvious........
3
dotneto
by: dotneto | last post by:
Hi, There is a strange behaviour with ie7 and browsing history. In a page (aspx), the user can download a file. If he navigates back from that page, the page is lost(from browsing history), an...
12
by: jim.richardson | last post by:
Hi all, I'd like a page to be excluded from the back button history, that is, when a user hits their browser's back button, it never backs into this particular page. Can anybody please tell...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.