Solved

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

Posted on 2016-11-15
9
71 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 500 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 500 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
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!

 

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

Industry Leaders: 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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

622 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