Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, April 13, 2018 4:11 PM
I am working on token authentication.</div> <div>I was going through an example on youtube.
I have
//--
var identity = (ClaimsIdentity)User.Identity; return OK("Hello " + identity.Name);
//--
Error CS0103 The name 'OK' does not exist in the current context
Suggestions?
TIA
Steve42
All replies (2)
Thursday, April 19, 2018 6:40 AM ✅Answered
Are you sure it shouldn't be with a lowercase 'k'?
return Ok("Hello " + identity.Name);
Ok is a method provided by the ApiController class. Are you creating an API using MVC?
Monday, April 16, 2018 7:39 AM
Hi sh,
According to your description, we couldn't directly find the reason why show this error.
Could you please post more about the name "OK"?
Is this username?
Do you use the asp.net web api?
Besides, I suggest you could post more details about the codes.
If you could post more detail information, it will be more easily for us to find the solution.
Best Regards,
Brando