views:

364

answers:

3

Hi I want to know if its possible and how to do the following , i have a basic MVC application (ASP.Net) that i have modified to work for me. Now the application already handles authentication perfectly fine but i need to use this authentication in another app.

Without creating a webservice is it possible for me to make calls to the applications authcontroller , if so how

Thanks again

+1  A: 

You can't directly call a controller in another application because it is in a separate AppDomain. If you just want to reuse the existing code, you could refactor it into a separate assembly (library project), include that assembly in your new application, and just reference it from your logon controller. If you are trying to do single-sign on, then you may want to look at existing SSO solutions, such as JA-SIG CAS 2.0.

tvanfosson
A: 

Authentication is a cross-cutting concern that shouldn't be embedded into a single use case/controller. AOP afficionados would say it should be encapsulated in an aspect.

duffymo
A: 

Whoa guys slow down , im still beginning MVC and all its related details , the single sign on looks promising , the reason i dont want to go that route yet or even refactor the code and include it in the second project is because its way too simple a project.

RC1140
Cut-n-paste works, too, but refactoring to a common, shared assembly isn't all that hard. Maybe give some more info on what it is you are really trying to accomplish.
tvanfosson