简体   繁体   中英

How do I call codebehind method from another ASP.NET app?

I have a scenario where I have a login page on a webforms app that the user is able to see after logging in from a separte app. Both apps share the same login information but reside on two separate servers. I want to call the following web forms method which resides within a codebehind file within an ASP.NET web forms app, but do so silently so that the user will not have to log in a second time with the same credentials.

 protected void btnLogin_Click(object sender, EventArgs e)
 {
 }

Is it possible to call the btnLogin_Click either through a url link or another method without modifying the web forms app so that I will not need to manually enter the page through its associated login page?

My caller function will be in an app with a separate login page accepting same credentials as the app where btnLogin_Click resides. I would like to try to log in from the caller side and silently login to the app where the codebehind resides so that the user will only need to login once.

How can I achieve this desired solution?

You should be able to link multiple web applications using forms authentication as long as you use the same validation and decryption keys.

check this article out.

http://msdn.microsoft.com/en-us/library/eb0zx8fc.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM