473,795 Members | 3,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

restrict access to page based on querystring value

Hi there, I've got the standard Dreamweaver restrict access to page behaviour
below –

<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUs ers="1,2,3"
MM_authFailedUR L="index.asp"
MM_grantAccess= false
If Session("MM_Use rname") <"" Then
If (false Or CStr(Session("M M_UserAuthoriza tion"))="") Or _
(InStr(1,MM_aut horizedUsers,Se ssion("MM_UserA uthorization")) >=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_aut hFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerV ariables("URL")
if (Len(Request.Qu eryString()) 0) Then MM_referrer = MM_referrer & "?" &
Request.QuerySt ring()
MM_authFailedUR L = MM_authFailedUR L & MM_qsChar & "accessdeni ed=" &
Server.URLEncod e(MM_referrer)
Response.Redire ct(MM_authFaile dURL)
End If
%>
It restricts access to the page based upon the following values –

MM_Username
MM_UserAuthoriz ation

I believe that is checking to see whether MM_Username exists and if so
checking to see if the MM_UserAuthoriz ation value is either 1, 2 or 3

I the event that both exist access is granted, in the event that one or
neither exist it redirects the user to MM_authFailedUR L (index.asp)

What I would like to do is build a similar behaviour, but that only checks
one value, so instead of checking MM_Username & MM_UserAuthoriz ation it
checks to see whether the variable ACC (which is sent through
Request.QuerySt ring) equals either –

Occ User
Reg User
Reg User5
Reg User10
Multi User

And in the event that ACC as one of the values above Access is granted, in
the event that this is not the case the user is redirected to info.asp.

Any ideas on how to do this would be great -

Thanks

Feb 23 '08 #1
3 3601
GTN170777 wrote:
Hi Brynn,

Thanks for the link, useful site,..

I have tried playing with the code a little and had put the following
together --

<%
If Request.QuerySt ring("ACC") NOT LIKE '%User%' Then
vbscript <sql

You have the option of using regex or Instr. Here is how it would look
with Instr:
dim acc
acc = Request.QuerySt ring("ACC")
if Instr(acc, "User") 0 then

Don't forget, Instr is case-sensitive. If you don't want case to be a
factor:
if Instr(lcase(acc ), "user") 0 then
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 25 '08 #2
Spot on again Bob, thanks

"Bob Barrows [MVP]" wrote:
GTN170777 wrote:
Hi Brynn,

Thanks for the link, useful site,..

I have tried playing with the code a little and had put the following
together --

<%
If Request.QuerySt ring("ACC") NOT LIKE '%User%' Then
vbscript <sql

You have the option of using regex or Instr. Here is how it would look
with Instr:
dim acc
acc = Request.QuerySt ring("ACC")
if Instr(acc, "User") 0 then

Don't forget, Instr is case-sensitive. If you don't want case to be a
factor:
if Instr(lcase(acc ), "user") 0 then
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 25 '08 #3
=?Utf-8?B?R1ROMTcwNzc 3?= wrote on 25 feb 2008 in
microsoft.publi c.inetserver.as p.general:
<%
If Request.QuerySt ring("ACC") NOT LIKE '%User%' Then
VBS does not understand apostrophed strings as litteral strings.

So this line will show an compilation error.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 25 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1762
by: Masterblue | last post by:
Hi, Right know im teaching myself a little about CDONTS . But know I want to sent data form a database with a form. I wou ld like to do the following: - I have made a page with set of records. - If you click on one of the records for more details you will go to a page with details. - Then when you like the details and you think that someone else would like to see them to you will do the following: add your name, your emailaddress and...
5
4931
by: rathnesh | last post by:
when using a web application which includes taking an asp page then going to another asp page and coming back to first page ...some times connection to iis gets terminated and page canot be displayed error comes ..this error does'nt comes on a particular page .please help me to solve this problem..
3
3133
by: Paul | last post by:
Hi all, at present I I've built a website which can be updated by admin and users. My problem, I've combined "log in" and "access levels" to restrict access to certain pages, using the built in "log in" and "user authentication, restrict access to page" features. But I find the after login I constantly get redirected from the restricted pages.
28
6425
by: gc | last post by:
Hi, What is the purpose of the restrict keyword? gc
7
2676
by: tweak | last post by:
Can someone give me a short example as how to best use this keyword in your code? This is my understanding: by definition restrict sounds like it is suppose to restrict access to memory location(s) pointed to, so that only one declared pointer can store that address and access the data in those memory blocks, where I the data in those location(s) can be changed. Is that a correct understanding?
0
2268
by: Matt Howeson | last post by:
Some time ago I posted a request for help with a problem I was having sometime ago whereby a 404 error would result if any access to the Querystring had been made before the Context.Rewritepath is called. (http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=66a19 d98.0212240627.3f123293%40posting.google.com) I have recently received a number of emails from people asking if I ever found a solution, so I thought I'd post...
4
1661
by: fxs | last post by:
Hello, I've got the following elements on my page: A Body tag that looks like this: <body onload="setTabs()"> A Javascript script in the <head> that has: var foo; function setTabs() { doSomething(foo);
1
2023
by: Rico | last post by:
I have tried to access a database using asp.net. after some entries like 120+, I got an unspecified error message. Anyone know what is happening, it seems to be stuck at the same line even when i added a new line. Here is the error message: Server Error in '/sonamy' Application. -------------------------------------------------------------------------------- Unspecified error
6
2381
by: rainy6144 | last post by:
Does the following code have defined behavior? double *new_array(unsigned n) { double *p = malloc(n * sizeof(double)); unsigned i; for (i = 0; i < n; i++) p = 0.0; return p; }
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.