I have created an mvc template application with role based authorization. When a user clicks on an action method meant for him(say About), he is redirected to the About view. But problem occurs when he clicks to another page(ex-home page) then comes again to About. This time he is redirected to login instead of the About page. What could be the possible reason/fix? Tried to clear cookies, history etc. Any help is appreciated
[RequireHttps]
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[Authorize(Roles ="ADMIN")]
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
[Authorize(Roles ="ANOTHER")]
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
This is the about.cshtml
@{
ViewBag.Title = "About";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<p>Use this area to provide additional information.</p>
This is Contact.cshtml
@{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>