469,939 Members | 2,345 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,939 developers. It's quick & easy.

best way to redirect asp to login htm page?

Hello,

I need users to access a data entry asp page via a login
page. If they bookmark the data entry asp I want to
redirect them to the login page (using IIS). Here is what
I had in mind:

<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
<script language="JavaScript">
function myFunction(s){
....
location.href='insert.htm';}
</SCRIPT>
</HEAD>
<body onLoad="myFunction('<%Response.write(Request.Form
("testfld"));%>')">
....

Isn't there some kind of authentication method for IIS, or
at least a less kludgy way of doing this than what I have
above? Just checking.

Thanks,
Rich
Jul 19 '05 #1
6 5521
have the login place a cookie/session variable...check for it...if it's not
there redirect

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Rich" <rp*****@aol.com> wrote in message
news:4e****************************@phx.gbl...
Hello,

I need users to access a data entry asp page via a login
page. If they bookmark the data entry asp I want to
redirect them to the login page (using IIS). Here is what
I had in mind:

<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
<script language="JavaScript">
function myFunction(s){
...
location.href='insert.htm';}
</SCRIPT>
</HEAD>
<body onLoad="myFunction('<%Response.write(Request.Form
("testfld"));%>')">
...

Isn't there some kind of authentication method for IIS, or
at least a less kludgy way of doing this than what I have
above? Just checking.

Thanks,
Rich

Jul 19 '05 #2
Thank you for your reply. This sounds logical. May I
request one more thing? I took a course in javascript
which used some asp examples a few years ago (didn't work
with it since then). Now I am back at it for real. We
did infact work with cookies, but I only vaguely remember
how to set/read them. Would have any sample syntax or
point me where I could see some examples? JS/vbs either
or.

Thanks again for your reply.

Rich

-----Original Message-----
have the login place a cookie/session variable...check for it...if it's notthere redirect

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Rich" <rp*****@aol.com> wrote in message
news:4e****************************@phx.gbl...
Hello,

I need users to access a data entry asp page via a login
page. If they bookmark the data entry asp I want to
redirect them to the login page (using IIS). Here is what I had in mind:

<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
<script language="JavaScript">
function myFunction(s){
...
location.href='insert.htm';}
</SCRIPT>
</HEAD>
<body onLoad="myFunction('<%Response.write(Request.Form
("testfld"));%>')">
...

Isn't there some kind of authentication method for IIS, or at least a less kludgy way of doing this than what I have above? Just checking.

Thanks,
Rich

.

Jul 19 '05 #3
VBScript

string = Request.Cookies("name")
Response.Cookies("name") = string
--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Rich" <rp*****@aol.com> wrote in message
news:4f****************************@phx.gbl...
Thank you for your reply. This sounds logical. May I
request one more thing? I took a course in javascript
which used some asp examples a few years ago (didn't work
with it since then). Now I am back at it for real. We
did infact work with cookies, but I only vaguely remember
how to set/read them. Would have any sample syntax or
point me where I could see some examples? JS/vbs either
or.

Thanks again for your reply.

Rich

-----Original Message-----
have the login place a cookie/session variable...check

for it...if it's not
there redirect

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Rich" <rp*****@aol.com> wrote in message
news:4e****************************@phx.gbl...
Hello,

I need users to access a data entry asp page via a login
page. If they bookmark the data entry asp I want to
redirect them to the login page (using IIS). Here is what I had in mind:

<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
<script language="JavaScript">
function myFunction(s){
...
location.href='insert.htm';}
</SCRIPT>
</HEAD>
<body onLoad="myFunction('<%Response.write(Request.Form
("testfld"));%>')">
...

Isn't there some kind of authentication method for IIS, or at least a less kludgy way of doing this than what I have above? Just checking.

Thanks,
Rich

.

Jul 19 '05 #4
Hey rich, does your login page submit straight to the data entry page?

If so then at the start of the data entry page you could just check that one
of the fields from your login page actually has data in it, and if it
doesn't then redirect the user back there.

so put this at thge start of your data entry page..

<%
if request.form("yourformfield")="" then

response.write "<script>alert('you must come here from the login
page.')</script>";
response.redirect "login.htm"

else
'show the data entry page
end if

%>

hoope this helps

dave

"Rich" <rp*****@aol.com> wrote in message
news:4e****************************@phx.gbl...
Hello,

I need users to access a data entry asp page via a login
page. If they bookmark the data entry asp I want to
redirect them to the login page (using IIS). Here is what
I had in mind:

<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
<script language="JavaScript">
function myFunction(s){
...
location.href='insert.htm';}
</SCRIPT>
</HEAD>
<body onLoad="myFunction('<%Response.write(Request.Form
("testfld"));%>')">
...

Isn't there some kind of authentication method for IIS, or
at least a less kludgy way of doing this than what I have
above? Just checking.

Thanks,
Rich

Jul 19 '05 #5
Thank you all for your responses. This really helps me
out. I actually know how to do this stuff in JSP, but I
don't want to use Tomcat because I am all hooked up with
IIS/SqlServer now. My vbscripting is weak, at best. Oh
well. I will be hanging around here a lot :).

Thanks again,
Rich
-----Original Message-----
Hello,

I need users to access a data entry asp page via a login
page. If they bookmark the data entry asp I want to
redirect them to the login page (using IIS). Here is whatI had in mind:

<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
<script language="JavaScript">
function myFunction(s){
....
location.href='insert.htm';}
</SCRIPT>
</HEAD>
<body onLoad="myFunction('<%Response.write(Request.Form
("testfld"));%>')">
....

Isn't there some kind of authentication method for IIS, orat least a less kludgy way of doing this than what I have
above? Just checking.

Thanks,
Rich
.

Jul 19 '05 #6
Rich, how about this? A friend of mine found this (or invented it).
Put it in your global.asa file in the Session_OnStart routine.

' If someone initially tries to load any page other than the
' start page, redirect them.
' NOTE - If the redirect happens, the rest of this function
' is not executed, so be sure this is LAST!

Session("requestedPage") = Request.ServerVariables("SCRIPT_NAME")
if not (STRCOMP(Application("StartPage"), Session("requestedPage"),
vbTextCompare)=0) then
Response.Redirect Application("StartPage")
end if

Works for me. No cookies (other than ASP's own). Just set
Application("StartPage") to "login.asp" (or whatever you're using) in
your Application_OnStart routine.

Tom

On Tue, 9 Sep 2003 07:52:56 -0700, "Rich" <rp*****@aol.com> wrote:
Thank you all for your responses. This really helps me
out. I actually know how to do this stuff in JSP, but I
don't want to use Tomcat because I am all hooked up with
IIS/SqlServer now. My vbscripting is weak, at best. Oh
well. I will be hanging around here a lot :).

Thanks again,
Rich
-----Original Message-----
Hello,

I need users to access a data entry asp page via a login
page. If they bookmark the data entry asp I want to
redirect them to the login page (using IIS). Here is

what
I had in mind:

<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
<script language="JavaScript">
function myFunction(s){
....
location.href='insert.htm';}
</SCRIPT>
</HEAD>
<body onLoad="myFunction('<%Response.write(Request.Form
("testfld"));%>')">
....

Isn't there some kind of authentication method for IIS,

or
at least a less kludgy way of doing this than what I have
above? Just checking.

Thanks,
Rich
.


Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Simon | last post: by
reply views Thread by Anonieko Ramos | last post: by
1 post views Thread by Sospeter | last post: by
3 posts views Thread by William Sullivan | last post: by
3 posts views Thread by jasonheath.net | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.