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
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
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
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
Open in new window