• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 105
  • Last Modified:

How would I automatically force all users who log in to specific Controller, then view? This is prevent them from using bookmarked pages. ASP.NET MVC

I would like to force all users, who log in to a specific controller (dashboard). My reasoning is that I want to run test on their accounts and force them to see any messages on the dashboard page.  How it works now is, if the user has a page book marked, they are forced to login, but then it redirects them to the page they bookmarked. I don't want this to happen, again I want them to go to dashboard page. How would I go about this?

Thanks!
0
bmanmike39
Asked:
bmanmike39
1 Solution
 
arnoldCommented:
If your site consists of pages that include common function, you would need to add to that a function that will check if this page has a referrer, and if not display a message on the page.
It could possibly make it more complicated to display a notice (by terminating the processing of the page) using a form that submits to itself/references the page .... Upon submit the desired page will be the destination and the referrer should be set.

Test before.
If your desire is to include referrals from external sources as well, you would need to check whether the referring page is within your site/s that are acceptable.
0
 
louisfrCommented:
The Login method should contain a line which redirects to the bookmarked page:
return RedirectToLocal(returnUrl);

Open in new window

If you want the user to be redirected to another place, here's where you can do that.
0
 
Eddie ShipmanAll-around developerCommented:
We set a session variable when they login and check to see if that variable is set. If it isn't, then they are redirected to the login page.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now