• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 93
  • Last Modified:

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

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
jlcannon
Asked:
jlcannon
  • 5
  • 4
2 Solutions
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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
 
jlcannonAuthor Commented:
I am getting the following error using the above code:

Type mismatch: 'Lower'
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jlcannonAuthor Commented:
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
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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
 
jlcannonAuthor Commented:
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
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
remove the line

Response.Clear
0
 
jlcannonAuthor Commented:
Thank you!
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now