Solved

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

Posted on 2016-10-29
3
61 Views
Last Modified: 2016-11-30
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
Comment
Question by:bmanmike39
3 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 41865780
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
 
LVL 11

Expert Comment

by:louisfr
ID: 41866508
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
 
LVL 26

Accepted Solution

by:
EddieShipman earned 500 total points
ID: 41867644
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question