troubleshooting Question

Redirect a page based off of persmissions

Avatar of kdeutsch
kdeutschFlag for United States of America asked on
ASP.NETVisual Basic.NET
7 Comments1 Solution205 ViewsLast Modified:
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!")
        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
            checkAdmin = True
        End If
    End Function

Cem Türk
Senior Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros