Nop2.0 Custom Authorization

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 лет назад
Hi,

I would like to create my own controller under Nop.Web.
I want unauthorized user can access my controller. However, Nop v2.0 redirects any unauthorized user to Login page.
So my question is how can I allow external application access my controller without redirecting to Login page.

Thank you.
Mingzhu
12 лет назад
Mingzhu wrote:
Hi,

I would like to create my own controller under Nop.Web.
I want unauthorized user can access my controller. However, Nop v2.0 redirects any unauthorized user to Login page.
So my question is how can I allow external application access my controller without redirecting to Login page.

Thank you.
Mingzhu


Mingzhu can you post your code? By default anonymous access should be allowed, look at the home controller:


    public class HomeController : BaseNopController
    {
        public ActionResult Index()
        {
            return View();
        }
    }


If you copied another controller maybe you accidentally copied code that restricts access.
12 лет назад
Hello,

Thank you for your reply.

I tried your code like the following.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Nop.Web.Controllers
{
    public class testController : BaseNopController
    {
        //
        // GET: /test/
        public ActionResult Index()
        {
            return View();
        }

    }
}

But, it still redirects to Login page.

Did I miss something?
12 лет назад
Forgive me for my stupid mistake!!!!

I disabled Anonymous Authentication in IIS.

Anyway, it works perfectly.

Thank you for your help.

Mingzhu
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.