Link to home
Create AccountLog in
Avatar of kdeutsch
kdeutschFlag for United States of America

asked on

Redirect a page based off of persmissions

I created a simple persmissions event that checks if someone was added to a a permissions database.
Whiel if gives them a response.write you do not have persmissions to view this page.  i want to add on to it to show this message and then redirect them to another page.  Follwoing is my code for page load and then the main code from my common file.
page Load
If checkAdmin() = False Then
            Response.Write("You do not have permission to view this page!")
            Response.End()
        End If

Common file code tha is called.
Public Shared Function checkAdmin() As Boolean
        Dim userLogon = Split(Current.User.Identity.Name, "\")(1)

        sql = "select intAdminID from tblAdmin where intAdminID = (select intID from WORSDotNet.dbo.tblUser " _
            & "where strLogon = '" & userLogon & "')"

        myDataTable = New DataTable
        myDataTable = getData(sql)

        If myDataTable.Rows.Count = 0 Then
            checkAdmin = False
        Else
            checkAdmin = True
        End If
    End Function

Avatar of Cem Türk
Cem Türk
Flag of Türkiye image


If checkAdmin() = False Then
            Response.Write("You do not have permission to view this page!")
Response.Write("<meta HTTP-EQUIV=""refresh"" content=0;url=""login.asp"">"
            Response.End()
        End If

Open in new window

Avatar of kdeutsch

ASKER

Hi,
I get a Blue underline under the last  quote that says          ')' Expected
I tried putting in a Parentethis and different ways but to no avial.
sorry small typo over there
If checkAdmin() = False Then
            Response.Write("You do not have permission to view this page!")
Response.Write("<meta HTTP-EQUIV=""refresh"" content=0;url=""login.asp"">")
            Response.End()
        End If

Open in new window

HI,
Ok it builds but it does not redirect to another page, I chagned the url to mine and it does not work??
Maybe somehting i am dong wrong.
 If checkAdmin() = False Then
            Response.Write("You do not have permission to view this page!")
            Response.Write("")
            Response.End()
        End If
ASKER CERTIFIED SOLUTION
Avatar of Cem Türk
Cem Türk
Flag of Türkiye image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Ok, see how it works.  I reworked the number as well to 3 seconds to give them time to view the message.  Thanks for the help.
your welcome