DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   The best way to redirect visitors... (http://www.daniweb.com/forums/thread33450.html)

goldeagle2005 Oct 6th, 2005 3:12 am
The best way to redirect visitors...
 
Im working on a college project. In this, the user is required to authenticate. The login page (login.asp) has the form and the corresponding ASP code. Once the user is successfully authenticated, the user is redirected to the main page(mediaguidehome.asp). Currently, on authentication, I'm using the following code to redirect the visitor:
<% asp code here %>
<SCRIPT Language="JavaScript">
location.href="/mediaguidehome.asp?user=<%=Request.Form("username")%>&pass=<%=Request.Form("password")%>"
</SCRIPT>

What I want to ask is this. Is it better to use The location.href JavaScript or do I use the HTTP Refresh statement (<META HTTP-EQUIV=Refresh CONTENT="0; URL=/mediaguidehome.asp?user=<%=Request.Form("username")%>&pass=<%=Request.Form("password")%>">
).


Please advise. Thanks.

tgreer Oct 6th, 2005 9:17 am
Re: The best way to redirect visitors...
 
The "standard" answer is that users may have JavaScript disabled. That said, I've never, once, in my career as a web developer (since the web was invented), encountered a user with JavaScript disabled.

goldeagle2005 Oct 6th, 2005 9:40 am
Re: The best way to redirect visitors...
 
Guess people are just too lazy to disable JavaScript.
Anyway, you're saying I ought to stick with the HTTP Refresh?

tgreer Oct 6th, 2005 9:52 am
Re: The best way to redirect visitors...
 
I'm saying, use both.

goldeagle2005 Oct 6th, 2005 9:56 am
Re: The best way to redirect visitors...
 
All righty then. Thanks.

zippee Oct 7th, 2005 12:06 pm
Re: The best way to redirect visitors...
 
As you are using ASP, why not just using respose.redirect function in asp?

tgreer Oct 7th, 2005 12:16 pm
Re: The best way to redirect visitors...
 
I agree. I tend to focus on client-side, since this is the forum for client-side techniques. Also, the user asked which of two client-side methods was better.

However, the BEST way to redirect users is with some server-side technique, as it saves a round-trip.

goldeagle2005 Oct 7th, 2005 2:04 pm
Re: The best way to redirect visitors...
 
hey tgreer and zippee..
You're right. I was so hung up on those two methods, I just forgot about the response.redirect method.

Thanks a lot, you guys.

zippee Oct 8th, 2005 5:42 am
Re: The best way to redirect visitors...
 
This is human! When a salesman asked whether you want to buy a red one or a blue one, you never think about saying "I don't need any" or "I prefer the white one"...

Good luck goldeagle.


All times are GMT -4. The time now is 5:10 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC