MVC 5 + Angular JS - Redirect to another website from controller action

115 views
Skip to first unread message

test...@gmail.com

unread,
Apr 11, 2016, 2:25:10 AM4/11/16
to AngularJS, anand...@ambitsoftware.com

Hello,


I am working on application (SPA) developed in MVC 5 & Angular JS. Currently I am implementing SSO with MS Azure using SAML 2.0 protocol. 

When the application tries to send SAML request to Azure, I am getting below exception.  (This error occurs only when I load the Angular Js first & then try to redirect. If I redirect before loading Angular Js then it works perfectly)

Error Description: "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access."

Can anyone please help me to resolve this issue?


Regards,

Anand

Exception.jpg

Sander Elias

unread,
Apr 11, 2016, 2:41:27 AM4/11/16
to AngularJS
Hi Test...

You should set your server to enable cors for your domain. There seems to be a difference in how you authenticate when using angular.

Regards
Sander

test...@gmail.com

unread,
Apr 11, 2016, 7:47:08 AM4/11/16
to AngularJS
Thanks Sander for ur reply.

I am new to MS Azure. How can I enable cors there?

Regards,
Anand

Tito

unread,
Apr 11, 2016, 2:33:11 PM4/11/16
to AngularJS
search for how to enable cors in google
for example
https://msdn.microsoft.com/en-us/library/azure/dn535601.aspx

test...@gmail.com

unread,
Apr 12, 2016, 1:33:21 AM4/12/16
to AngularJS
Thanks for reply Tito.

I have gone through these links much earlier. I am not using any Storage Services of Azure.

I am using Azure Active Directory where my application posts a SAML request for authentication. Once authentication is successful, it returns SAML response to application.

This is the point (Sending request to MS Azure from application) where I am struggling now.

Regards,
Anand   

Sander Elias

unread,
Apr 12, 2016, 1:55:58 AM4/12/16
to AngularJS
Hi Anand,

Here I found this article that seems to explain how to enable CORS on azure apps. In there is even a angular sample too.

Regards
Sander
Message has been deleted

test...@gmail.com

unread,
Apr 15, 2016, 7:04:05 AM4/15/16
to AngularJS
Thanks Sander. Finally I have implemented a work around rather than enabling the CORS on azure.
Reply all
Reply to author
Forward
0 new messages