Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am new at MVC 4. I have created MVC 4 application. I am using Basic Authentication. When I am first time loading then it works fine, it asks credentials. But when I make Ajax call from same view without any credentials still it calls Controllers Action. As I am using basic Authentication it suppose to ask credentials or it suppose to give error Unauthorized, but it makes calls to Action and then when result comes from Controllers action it says 401 Unauthorized. But it is not error, Ajax request is successful.

Please let me know how to make Basic Authentication for Ajax call from view to Action with credentials?

Thanks in advance....
Posted

1 solution

I got its solution,

1. you just set basic authentication from IIS
2. Set [Authorize] attribute to all actions.
3. send user name and password from ajax call.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900