Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website asks for "Authentication Required" on an MVC controller, but not others

I have an asp.net C# MVC website. It uses SimpleAuthentication and forms authentication. Everything works fine, requiring people to log in to go to pages. However, I have one controller called "ReportsController". Whenever you go to the URL's of the actions within this controller it always pops up with "Authentication Required" in the browser window.

It is only doing it for this controller and not any others. The URL will be "www.domain.com/reports". This URL works fine when I run from IIS and from my development server, but not on my live server. This is running IIS7.

I have checked my web.config and it is definately set to Forms authentication and not Windows.

Anyone have any ideas why any urls beginning with "/Reports" would not work. I am guessing it is something specific to the server, such as an IIS setting or web.config change, but I cannot figure out what this would be.

namespace ProjectName.Controllers
{
    public class ReportsController : Controller
    {
        public ActionResult Index()
        {
            throw new SystemException("here");

            return View();
        }
    }
}

Web.config:

<authentication mode="Forms">
  <forms loginUrl="~/" timeout="2880" />
</authentication>
like image 523
user1616625 Avatar asked Mar 12 '14 10:03

user1616625


1 Answers

So it turns out that Sql Server Reporting Services was running on the server. This was taking control of the "/Reports" URL on all websites on that server.

I am not using SQL Server Reports, so I went to "Reporting Services Configuration Manager" on the server and removed the IP address and port it was listening on. You can also change the URL it uses instead if you still need to use this.

like image 187
user1616625 Avatar answered Nov 11 '22 00:11

user1616625