Avatar of kdeutsch
kdeutsch
Flag 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

ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
Cem Türk

8/22/2022 - Mon
Cem Türk


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

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.
Cem Türk

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

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
kdeutsch

ASKER
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
Cem Türk

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
kdeutsch

ASKER
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.
Cem Türk

your welcome
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.