TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sachin Singh
7
55.8k
81.7k
IIS basic authentication with web api.
Aug 17 2020 11:07 AM
Believe me there is no solution given anywhere for this.
I have created a web api project
Enabled the Cors
deployed the web api in iis 7.5
Enabled Basic authentication (IIS Basic auth mode)
Send an ajax request like below
function getEmployee() {
debugger;
$.ajax({
"type"
:
"get"
,
"url"
:
"http://localhost:8080/api/employeeservice"
,
"xhrFields"
: {
"withCredentials"
:
true
},
"dataTpe"
:
"Json"
,
"headers"
: {
'Authorization'
:
'Basic'
+ btoa(
'XYZ'
+
":"
+
'XYZ123'
)
},
"cache"
:
false
,
"crossDomain"
:
true
,
"success"
: function (data) {
$(data).each(function (i, y) {
var trr = document.createElement(
"tr"
);
$(trr).append(
""
+ y.Id +
""
).append(
""
+ y.Name +
""
).append(
""
+ y.DOB +
""
).append(
""
+ y.Salary +
""
).append(
""
+ y.Gender +
""
);
$(
"table tbody"
).append(trr);
});
},
})
}
I have given my 3 hours of dedicated time to make this work , read all thread in StackOverflow but nothing worked.
Always getting the cors error even when Cors is enabled and works fine when i test with MVC or jqeuery (different port No) without hosting it on IIS.Only the authentication is creating chaos.
The first thing that may come to your mind is who uses the basic authentication and moreover IIS basic auth, obviously no one , but this is just for knowledge purpose.I am very curious when its a matter of any technology.
So please help me , otherwise it may take my whole week.
Reply
Answers (
2
)
create thumbnail in asp.net entity framework
DLL Import in c#