Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.NET重定向到默认重定向url以外的页面_Asp.net_Forms Authentication - Fatal编程技术网

ASP.NET重定向到默认重定向url以外的页面

ASP.NET重定向到默认重定向url以外的页面,asp.net,forms-authentication,Asp.net,Forms Authentication,在asp.net中,我们在使用表单身份验证时指定重定向url,如下所示: <authentication mode="Forms"> <forms name="myApp" loginUrl="Login.aspx" protection="All" defaultUrl="default.aspx" path="/" requireSSL="false"/> </authentication> 现在是否可以让用户在登

在asp.net中,我们在使用表单身份验证时指定重定向url,如下所示:

<authentication mode="Forms">
            <forms name="myApp" loginUrl="Login.aspx" protection="All" defaultUrl="default.aspx" path="/" requireSSL="false"/>
        </authentication>
现在是否可以让用户在登录前选择要重定向到的页面

例如,用户在登录之前从列表中选择要登录的页面,然后在进行身份验证时重定向到此页面,而不是default.aspx页面

这可能吗?如果可能,如何做到这一点?

您可以使用该方法,然后手动重定向:

FormsAuthentication.SetAuthCookie(IDTextBox.Text, RememberCheckBox.Checked);
Response.Redirect("some url the user has choosen");
FormsAuthentication.SetAuthCookie(IDTextBox.Text, RememberCheckBox.Checked);
Response.Redirect("some url the user has choosen");