开发者

How to implement customized home-page for different users?

I have an ASP.Net(VB.Net) project which has various modules/functionality.开发者_如何学Go I want to give users the freedom to set their own default startup page.

I don't know how to get a head-start implementing this feature.

Also, I am NOT using MVC


On the master page place some control to choose current page as default (i.e. button or checkbox). After user has select current page as default you can store the page address to user's profile or any storage you like. Set the site start page like Default.aspx and in the Page_Load method of this page read user's saved default page if exists and redirect to it.


You'd want to set up a way for the User to store their preferred home page in your database (or your preferred method). Once that's done you should be able to do this in a simple fashion:

ASP.NET WebForms:

  1. On the Master Page / Default page, check to see if they're logged in in your Page_Load event.
  2. If they are, check to see if they have a start up page saved, if they do then use Response.Redirect and send them to their preferred location.
  3. If they don't, or aren't logged in, then show them the default page.

ASP.NET MVC:

  1. On the HomeController's Index method check to see if they're logged in.
  2. If they are, check to see if they have a start up page saved, if they do then use RedirectToAction and send them to their preferred location.
  3. If they don't, or aren't logged in, then show them the default view.

There are probably plenty of other ways to accomplish this as well, but this should be a straight forward way to get your started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜