Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Restrict access so only users whos userid begins with "u" are able to access the web page

Posted on 2016-11-15
9
Medium Priority
?
78 Views
Last Modified: 2016-11-21
I am able to pull user information as folks access my web page on the intranet. I have a page I want to restrict access to so that only those that have a userid that starts with the letter "u" are able to open it. What is the easiest way to do that.
0
Comment
Question by:jlcannon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 41888587
if userID is a variable, you can do something like this:

if Lower( Left( userID, 1 ) ) = "u" then
      '-- user has access
else
       '-- user doesn't have access, maybe do a redirect to another page
       Response.Redirect "someOtherPage.asp"
end if
1
 

Author Comment

by:jlcannon
ID: 41888681
I am getting the following error using the above code:

Type mismatch: 'Lower'
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 2000 total points
ID: 41888684
sorry, Lower should be LCase, brain fart there. also, if userID is blank or null, you'll get an error, so if thats a possibility, make sure you check for it
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jlcannon
ID: 41888761
Ok now I am trying to work out this error:

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content

I have gone as far as moving everything to before the HTML tag but still get this error.

   <%
Response.Buffer = True
%>
			<%
			
			if LCase( Left( vUID, 1 ) ) = "u" then
                    '-- user has access
                    Response.Clear
                    Response.Redirect "EffDash.asp"
                    
        Response.End
          
 end if %>

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 41888769
the code you have will redirect if the userID begins with the letter "u", is that what you want?

there is no error listed above...
0
 

Author Comment

by:jlcannon
ID: 41888777
yes that is what I want but if I try to use the code as in your response using the LCase if statement I get the error

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 41888782
remove the line

Response.Clear
0
 

Author Comment

by:jlcannon
ID: 41888792
Thank you!
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 41888795
glad to help :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question