Reputation: 743
I am not sure why this is not working.
I am verifying the logged on person has the correct security, if they do not I want to redirect them to another page.
If they do have the correct security the rest of the code on the page will continue to execute.
When I step through the code, it does execute the response.redirect, but the page continues to load.
strSQL = "Select * from tblSecurity Where SFID = '" & Right(My.User.Name, 4) & "' and (SecurityLevel = '900' or SecurityLevel = '850')"
ds = objData.SQLExecuteDataset(strSQL, CommandType.Text)
If ds.Tables(0).Rows.Count = 0 Then
Response.Redirect("~/NotAuthorized.aspx", False)
End If
Upvotes: 0
Views: 2284
Reputation: 2294
I tried all this and more ... and I only note my solution here for posterity and my own reference later. I ran into this problem while I had about 6 VS projects open, each in their own VS instance. Once I closed all but the one project down the problem went away. I am not sure what it was about the other project(s) that caused this particular problem but apparently VS doesn't like having too many of itself open.
Upvotes: 0
Reputation: 1
dont give the table value equal to zero...give the validation like ds.Tables(0).Rows.Count > 0... it means the table is holding the record if the given login details are right.
Upvotes: 0
Reputation: 887305
That's exactly what you told it to do.
Passing false
as the second parameter makes it not terminate the current page.
Upvotes: 7