Solved

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

Posted on 2016-11-15
9
59 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 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Find out what you should include to make the best professional email signature for your organization.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

821 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