If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > using an IF ELSE to response.redirect

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-26-04, 13:15
jaberwocky jaberwocky is offline
Registered User
 
Join Date: Feb 2004
Location: Vancouver
Posts: 17
using an IF ELSE to response.redirect

Hi folks. i am taking a stab in the dark here:
I run an intranet and on my asp pages i capture the userID of the person visiting my web page, using <%
Userid=mid(Request.ServerVariables ("LOGON_USER"),5)
%>
at the top of my pages

Is there anyway i can use an IF, ELSE function so that if a userID = xxxx then response.redirect to xxxx.asp else response.redirect yyy.asp?

I am thinking something like:
Code:
if ("userid")=ID1, ID2, ID3 then
	response.redirect "page1.asp"

else
	response.redirect "page2.asp"
		
end if
All i need is a simple .asp page to redirect the user to another page, based soley on their userid i capture at the top of the page usinf <%
Userid=mid(Request.ServerVariables ("LOGON_USER"),5)
%>

I need it to look at multiple userid's as shown above ie ID1,ID2 etc

any help?
thanks
__________________
still in the baby steps of coding
Reply With Quote
  #2 (permalink)  
Old 02-26-04, 17:14
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
If userID = d1 Then
response.redirect "page1.asp"
ElseIf userID = D2 Then
response.redirect "page2.asp"
ElseIf userID = D3 Then
response.redirect "page3.asp"
End If
Reply With Quote
  #3 (permalink)  
Old 02-27-04, 02:12
rturner003 rturner003 is offline
Registered User
 
Join Date: Feb 2004
Location: Bristol, UK
Posts: 2
I am not sure what the VB method but in JScript I would use the switch command. for example:

switch (userID)
{
case "rt1":Response.Redirect("xxx.asp");break;
case "de1":Response.Redirect("zzzzz.asp");break;
default:Response.Redirect("sssss.asp");break;
}
Reply With Quote
  #4 (permalink)  
Old 02-27-04, 11:26
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
In ASP, we use

Select Case testexpression
[Case expressionlist-n
[statements-n]] . . .
[Case Else
[elsestatements-n]]
End Select

Here is the link for the reference from Microsoft

http://msdn.microsoft.com/library/de...statements.asp
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On