Try our conversational search powered by Generative AI!

Disable 401 redirect - EPI 7.5 MVC

Vote:
 

Hello

We have a controller, /exampleUrl, that talks to an external API. Our frontend uses AJAX to talk to the controller.

The external API returns an error sometimes and then I want to send a 401 statuscode back to the frontend.

I've noticed that when sending back a 401 to the client, EPI hooks in and redirects me to the loginpage for the CMS...can I somehow turn this off?

I've added this to my web.config but it doesn't work...what am I missing?


      
      
        
      
      



#141305
Nov 11, 2015 15:49
Vote:
 

Heres the correct web.config entry...

  <location path="exampleUrl">
    <system.web>
      <authentication mode="None" />
      <authorization>
        <allow users="*"/>
      </authorization>
      <customErrors mode="Off"></customErrors>
    </system.web>
 </location>



#141306
Nov 11, 2015 15:50
Vote:
 

Solved it like this.

protected void Application_BeginRequest()
{
     var startUrl = "/exampleUrl";
     if(Request.Url.AbsolutePath.StartsWith(startUrl))
     {
         Response.SuppressFormsAuthenticationRedirect = true;
     }
}
#141326
Nov 12, 2015 9:09
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.