Pergunta

I've been searching for an answer to my question for a while now, but can't find what I'm looking for so I hope someone can help me :)

Scenario:

3 Projects:

  • Asp.net Web Api Project (SQL Server CE 4 database + Asp.Net Membership)
  • Windows Phone 7.5 App (Authenticates to the SQL Server CE database using REST)
  • Asp.net MVC 4 Project (That wants to communicate to the same SQL Server CE database, also using REST)

The WP7 app's authentications is already working. But I'm having problems with trying to figure out on how to let my MVC app authenticate with the same SQL Server CE database.

I'm probably able to create my own controls and use the same logic to authenticate that I've used in the WP7 app, but I want to keep the existing functionality that the [Authorize] attribute offers.

So my question is:

how can I let my MVC project authenticate through the Web Api project, and still maintain the functionality that when a user tries to access a page that needs authentication, he will be redirected to the login page and such

I hope my question is clear enough! If not, don't hesitate to ask some additional questions!

Kind Regards,

Gert

Foi útil?

Solução

Ok, after some rest and some logical thinking, I just realized that I had to change the Login method in the AccountController in the MVC project.

I'm not able to provide any code because I'm not on my dev pc, but it's just any authentication code you would use anywhere else. For example using REST authentication or authentication through a WCF service.

Kind regards,

Gert

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top