如何使用Windows身份验证将所有初始请求重定向到特定页面

4
我有一个在Windows身份验证模式下运行的asp.net Web应用程序。我的要求是,无论用户第一次请求哪个页面(URLs),它都应该被重定向到LandingPage.aspx。 有人能建议如何使用Windows身份验证将所有初始请求重定向到特定页面(LandingPage.aspx)吗?
提前感谢您。

请看这个Windows身份验证重定向 - K D
你不能使用Server.Transfer或Response.Redirect吗? - Alex
我尝试将此内容放在Web.Config文件中,但结果并非如预期所示: <authentication mode="Windows"> <forms name=".Test" loginUrl="Landingpage.aspx" defaultUrl="default.aspx" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" domain="companySite" enableCrossAppRedirects="true"> <credentials passwordFormat="SHA1" /> </forms> <passport redirectUrl="internal" /> </authentication> - user1660592
1个回答

0

我认为你可以使用Global.asax文件的Session_Start方法并重定向到你的着陆页。

void Session_Start(object sender, EventArgs e)
{
    Response.Redirect("LandingPage.aspx");
}

我不能使用这个,因为在某些页面上我已经禁用了会话。所以当用户直接访问被禁用会话的页面时,这段代码将无法工作。 - user1660592

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接