Solved

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

Posted on 2016-11-15
9
19 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
  • 5
  • 4
9 Comments
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
Comment Utility
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
Comment Utility
I am getting the following error using the above code:

Type mismatch: 'Lower'
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
Comment Utility
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
 

Author Comment

by:jlcannon
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
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
Comment Utility
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 32

Expert Comment

by:Big Monty
Comment Utility
remove the line

Response.Clear
0
 

Author Comment

by:jlcannon
Comment Utility
Thank you!
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
glad to help :)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now