views:

27

answers:

3

Well the title isn't very descriptive but I'm not exactly sure how to explain but here goes!

I have a web application (can use either MVC or standard web forms) which a user signs in to. If the user has signed up for more than one product they will have the option to switch between them. For the sakes of this example lets say User1 signs in and has access to Product1, Product2 and Product3.

Now, each product will be very different and offer different functionally. What I want is the main view to be focused around the product they have selected and not redirected to a sub domain.

What I don't want to have to do is get them to go to www.mysite.com/product1 or www.mysite.com/product2 but simply www.mysite.com regardless of the product they have selected and have the site render the views etc for that product.

Wow does any of that make any sense? I was thinking mabe the use of sessions or something and URL rewriting? Are there any sample apps out there that make use of the same kind of functionallity that I could take a look at?

Thanks for any help I appreciate it!

A: 

To keep the product ID out of the URL, you can post your product selection page to the server with a hidden control that contains the desired product ID.

<input type="hidden">

Once you have the value in your codebehind or controller method, you can then set a Session variable with the product id to maintain persistence, and then perform a redirect to the appropriate product page.

This will work in both ASP.NET and ASP.NET MVC.

Robert Harvey
A: 

If you could elaborate more, that would be helpful.

Here is my shot at the answer from what I understood:

What you could do is redirect to the user to a specific page after they login.

     public ActionResult Login()
     {
          //Login Logic
          if(UserLoggedIn)
          {
             User MembershipUser = GetUser(User.Identity.Name);
             if(MembershipUser.HasProduct1)
                 return View("Product1");
             else if(MembershipUser.HasProduct2)
                 return View("Product2");
             else if(MembershipUser.HasProduct3)
                 return View("Product3");
          }
     }

It would be just a simple redirect to a specific view depending on the user's product.

If you could elaborate more, I could give a better answer.

Baddie
Imagine (for the sake of this) that each product provides different functions within the website. Let's say Product1 is an employee management area. So when 'inside' product1 the only options that they would have on the menu etc could be 'View Employees', 'New Employee' .... Now when they select Product2 which could be a product management area they would only have product related options so the main menu etc would change to product 2 specific functionallity. But they can jump between products at any time while signed in (if they have access ofcourse)
Wayne
A: 

I think I am going to go with a custom ViewEngine in ASP.NET MVC. I can render different views depending on the product chosen that way. Thanks to everyone for their suggestions.

Wayne