asp.net web api2 - Error CS0246 when launching C# web API -


i developing web api 2 project , trying set basic authentication system on rest server. i'm having issues error when launch application , don't find origin of error.

class code :

using system; using system.collections.generic; using system.linq; using system.net; using system.net.http; using system.net.http.headers; using system.threading; using system.threading.tasks; using system.web; using system.web.http;  namespace calypsowebapplication.app_code {     public class resultwithchallenge : ihttpactionresult     {         private readonly system.web.http.ihttpactionresult next;          public resultwithchallenge(ihttpactionresult next)         {             this.next = next;         }          public async task<httpresponsemessage> executeasync(                                     cancellationtoken cancellationtoken)         {             var res = await next.executeasync(cancellationtoken);             if (res.statuscode == httpstatuscode.unauthorized)             {                 res.headers.wwwauthenticate.add(                    new authenticationheadervalue("basic", null));             }              return res;         }     } } 

erreur au lancement :

message d'erreur du compilateur: cs0246: le type ou le nom d'espace de noms 'httpresponsemessage' est introuvable (une directive using ou une référence d'assembly est-elle manquante ?)

english translation : type or namespace 'httpresponsemessage' cannot found, using directive or assembly reference missing ?

erreur source: ligne 22 : } ligne 23 : ligne 24 : public async task executeasync( ligne 25 : cancellationtoken cancellationtoken) ligne 26 : { fichier source: e:\users\mehin\documents\visual studio 2013\projects\calypso\calypsowebapplication\app_code\resultwithchallenge.cs ligne: 24

whe looking on https://msdn.microsoft.com/fr-fr/library/w7xf6dxs.aspx possibles sources of error, still don't understand why happens.

  • target framework .net 4.5
  • in project references, have "system.net.http" targets system.netnhttp.dll, version 4.0.0.0
  • when trying prefix httpresponsemessage system.net.http, error still occurs.
  • when cleaning , building solution in visual studio 2013, don't error. when launch application.

i don't know else add, don't hesitate ask more details.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -