Asp.net 在VB中显示未经授权的页面
我有以下功能: 在a.aspx.vb页面中:Asp.net 在VB中显示未经授权的页面,asp.net,vb.net,Asp.net,Vb.net,我有以下功能: 在a.aspx.vb页面中: If a = True Then 'do something Else 'i want to show a not authorized page here End If 我是否必须创建一个新页面并在“其他”下提供url以显示未授权页面? 或者在.net 4.0中是否有其他预构建的方法来实现这一点?尝试以下方法: If a=true then response.redirect("/Default.aspx") Else resp
If a = True Then
'do something
Else
'i want to show a not authorized page here
End If
我是否必须创建一个新页面并在“其他”下提供url以显示未授权页面?
或者在.net 4.0中是否有其他预构建的方法来实现这一点?尝试以下方法:
If a=true then
response.redirect("/Default.aspx")
Else
response.redirect("/ErrorPage.aspx")
End If
是的,只需重定向到“错误”页面
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
我必须创建Not_Authorized.aspx页面吗?@NeyerMe是的,你需要创建一个未经授权的页面(即错误页面),如果用户未经身份验证,你可以将他们重定向到该页面。@NeyerMe根据DotNetter,如果你想让他们在该页面上做些什么,你需要一个页面。当然,您可以将重定向放回主页,并在会话变量中使用错误消息更新该页面上的标签。