We help IT Professionals succeed at work.

how to login with different type of users ?

mmccy asked
Medium Priority
Last Modified: 2013-12-24
I have a table in sql server that contain username , usertype, password
how to making different login type and redirect to different pages ??
any suggestions  ?? any sample code ?? please !!

thx thx !!
Watch Question

Create an intermediate file to redirect to appropriate file based on the user type. like,

<cfif #GetUserDetails.usertype# eq 'Admin'>
  <cflocation url="admin_user_page.cfm">
  <cflocation url="general_user_page.cfm">

<cfquery name="getUser">
    select  *
    from    UserTable
    where   UserName = '#form.UserName#'

<cfswitch expression="#getUser.UserType#">
    <cfcase value="Admin">
        <cflocation url="AdminPage.cfm" />
    <cfcase value="Normal">
        <cflocation url="NormalPage.cfm" />
        <cflocation url="Logout.cfm" />

If several types go to the one page, you can use a comma seperated list. This is much cleaner than if elseif constructs.
<cfcase value="Normal,Admin">


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.