开发者

Single Sign On with 3 applications

开发者 https://www.devze.com 2022-12-31 14:52 出处:网络
I\'m building three web applications in .NET that will all share a users database and login information. Lets pretend that application 1 is the \"parent\" application and applications \"A\" and \"B\"

I'm building three web applications in .NET that will all share a users database and login information. Lets pretend that application 1 is the "parent" application and applications "A" and "B" are the "child" applications. All users have to be logged into application 1 to have access to applications A and B.

Authorization, Authentication, and MachineKey sections of all web configs are present and work correctly.

I have the correct web.config settings in all applications to achieve Single Sign On except one problem remains: what do I p开发者_开发知识库ut in the "loginUrl" attribute of the forms tag in Applications A and B.

Assume that the url for the login to application 1 is "www.johnsapp.com/login.aspx" How can I get applications A and B to send the user back to application 1 for authentication using only settings in web.config?


You could use

if (!Request.IsAuthenticated)
    Response.Redirect("~/Login.aspx?ReturnUrl=~/thisurl");

in the Page_Load function of the codebehind. This will redirect automatically.


How about using Windows authentication?

0

精彩评论

暂无评论...
验证码 换一张
取 消