NoviceMe
NoviceMe

Reputation: 3256

Show a page in VB you are not authorized

I have following function:

in a.aspx.vb page:

If  a = True Then
    'do something
Else
    'i want to show a not authorized page here
End If

Will i have to create a new page and give the url under else to show not authorized page? Or is there any other pre-built way to do this in .net 4.0?

Upvotes: 0

Views: 254

Answers (2)

Rob
Rob

Reputation: 1216

Yes, just put in a redirect to the 'error' page.

If  a = True Then
    'do something
Else
    'i want to show a not authorized page here, this page would reside in the root of the site, so if http://domainname.com/Not_Authorized.aspx then enter it as  Response.redirect("Not_Authorized.aspx") 

     Response.redirect("Not_Authorized.aspx") 
End If

Upvotes: 0

coder
coder

Reputation: 13248

Try this:

If a=true then
response.redirect("/Default.aspx")
Else
response.redirect("/ErrorPage.aspx")
End If

Upvotes: 2

Related Questions