簡體   English   中英

如何使用Autentication將頁面定向到ASP.NET中的另一個頁面

[英]how to direct page to another page in ASP.NET using Autentication

LdapAuthentication adAuth = new LdapAuthentication(adPath);
  try
  {
    if(true == adAuth.IsAuthenticated(txtDomain.Text, txtUsername.Text, txtPassword.Text))
    {
      //You can redirect now.
      Server.Transfer("~/WebForm2.aspx");
    }

我想將登錄頁面移動到默認頁面(webform.2),但結果是對〜/ WebForm2.aspx執行子請求時出錯。 我寫錯代碼了嗎? 也許我丟失了一些代碼。

嘗試

Response.Redirect("WebForm2.aspx", false); 

或將webform放置在任何其他文件夾中。 然后用完整的路徑

Response.Redirect("~/pages/WebForm2.aspx", false); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM