Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:33:44+00:00 2026-06-06T13:33:44+00:00

Controller: public class HomeController : Controller { Models.MakaleSitesiDBEntities entity = new Models.MakaleSitesiDBEntities(); public ActionResult

  • 0

Controller:

public class HomeController : Controller
{
    Models.MakaleSitesiDBEntities entity = new Models.MakaleSitesiDBEntities();

    public ActionResult ArticlesByCategory(int CategoryId)
    {
        IEnumerable<Models.TableArticles> articles = entity.TableArticles.Where(a => a.CategoryId == CategoryId && a.IsActive == true).OrderBy(a => a.PublishedOn);

        return View(articles.Reverse());
    }

    public ActionResult ArticleDetails(Guid ArticleId)
    {
        if (Session["IsUserRead"] == null || (Guid)Session["IsUserRead"] != ArticleId)
        {
            Session["IsUserRead"] = ArticleId;
            Models.TableArticles article = entity.TableArticles.Where(a => a.ArticleId == ArticleId).SingleOrDefault();
            article.ViewCount++;
            entity.SaveChanges();
        }

        return View(entity.TableArticles.Where(a => a.ArticleId == ArticleId).SingleOrDefault());
    }
}

ArticlesByCategory allows Anonymous Users but ArticleDetails not. It routes page to loginpage?

global.asax

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace MakaleSitesi
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode, 
// visit http://go.microsoft.com/?LinkId=9394801

public class MvcApplication : System.Web.HttpApplication
{
    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleErrorAttribute());
    }

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }

    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        // Use LocalDB for Entity Framework by default
        Database.DefaultConnectionFactory = new SqlConnectionFactory("Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True");

        RegisterGlobalFilters(GlobalFilters.Filters);
        RegisterRoutes(RouteTable.Routes);

        BundleTable.Bundles.RegisterTemplateBundles();
    }
}
}

Why this is happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:33:47+00:00Added an answer on June 6, 2026 at 1:33 pm

    One possible explanation for this behavior is that the request is hitting some other controller action that is decorated with the [Authorize] attribute, not the ArticleDetails action. This could happen because of some custom routing setup that you might have done which doesn’t work as you expect.

    Another possible explanation is that you have some configuration in IIS or whatever web server you are using which denies anonymous access to a given url.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class HomeController : Controller { public ActionResult Index() { Task<string> t = DownloadStringTaskAsync(new
Have Controller: public class MyController : Controller { [HttpGet] public ActionResult MyAction(int iMode, string
Controller to get an image: public class PicturesSmallController : Controller { public ActionResult Details(int
Consider: public class HomeController : Controller { private IDependency dependency; public HomeController(IDependency dependency) {
I have this controller: public class StandingsController : Controller { public ViewResult Index(int id)
I write a controller like below: public class AccountController : Controller { public ActionResult
earlier I use Spring MVC and annotation @ModelAttribute. @Controller public class ArticleController { @ModelAttribute(articles)
I have a very simple MVC app at this point: Controller: public class HomeController
public class ViewModelTables : IEnumerable , IEnumerator { public List<Order> orderList = new List<Order>();
Let's say I have an async controller like that below ~ public class HomeController

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.