asp.net mvc and portal like functionality

Posted by richard-heesbeen on Stack Overflow See other posts from Stack Overflow or by richard-heesbeen
Published on 2010-05-26T06:29:55Z Indexed on 2010/05/26 6:31 UTC
Read the original article Hit count: 332

fHi,

I need to build an site with some portal like functionality where an param in the request will indentify the portal. like so http:/domain/controller/action/portal

Now my problem is if an portal doesn't exists there must be an redirect to an other site/page and an user can login in to one portal but if the user comes to an other portal the user must be redirected back to the login page for that portal.

I have something working now, but i feel like there must be an central place in the pipeline to handle this. My current solution uses an custom action filter which checks the portal param and sees if the portal exists and checks if the user logged on in that portal (the portal the user logged on for is in the authentication cookie). I make my own IIndentiy and IPrincipal in the application_postauthentication event.

I have 2 problems with my current approach:

1: It's not really enforced, i have to add the attributes to all controllers and/or actions.

2: The isauthenticated on an user isn't really working, i would like that to work. But for that i need to have access to the params of the route when i create my IPrincipal/IIndenty and i can't seem to find an correct place to do that.

Hope someone can give me some pointers, Richard.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about mvc