2012-01-18 7 views
0

を認可されていません。私は機能を以下しているVBのページを表示します許可されていないページを表示するには? これは、.net 4.0でこれを行うための他の既成の方法ですか?はあなたが

答えて

0

を。

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 
+0

Not_Authorized.aspxページを作成する必要がありますか? – NoviceMe

+0

@ NoviceMe - 権限のないページ(つまり、エラーページ)を作成する必要があります。ユーザーが認証されていない場合は、そのページにリダイレクトできます。 – coder

+0

@NoviceMe DotNetterのように、何かしたい場合はページが必要です。もちろん、リダイレクトをホームページに戻して、セッション変数でそのページのLabelをエラーメッセージで更新することができます。 – Rob

2

このお試しください:はい、ちょうど 'エラー' ページへのリダイレクトに入れ

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