Click here to Skip to main content
14,667,416 members
Home » Discussions » ASP.NET
   

ASP.NET

 
AnswerRe: Net Core API question Pin
Richard Deeming22-May-20 5:56
mveRichard Deeming22-May-20 5:56 
GeneralRe: Net Core API question Pin
pkfox22-May-20 7:05
professionalpkfox22-May-20 7:05 
QuestionHow do I multiple group in Active Directory ? Pin
ugurarslanm19-May-20 4:58
Memberugurarslanm19-May-20 4:58 
QuestionHow to invoke POST method by adding [FromBody] attribute in Postman tool Pin
meeram3917-May-20 23:33
professionalmeeram3917-May-20 23:33 
AnswerRe: How to invoke POST method by adding [FromBody] attribute in Postman tool Pin
Richard Deeming18-May-20 1:12
mveRichard Deeming18-May-20 1:12 
GeneralRe: How to invoke POST method by adding [FromBody] attribute in Postman tool Pin
meeram3918-May-20 1:19
professionalmeeram3918-May-20 1:19 
GeneralRe: How to invoke POST method by adding [FromBody] attribute in Postman tool Pin
Stefanie Eberhardt19-May-20 4:29
MemberStefanie Eberhardt19-May-20 4:29 
QuestionAPI fail to use PUT method Pin
feelblue8717-May-20 22:42
Memberfeelblue8717-May-20 22:42 
i able to call Get Method.
but fail to call PUT, DELETE Method.

i added in webconfig.

<system.webServer>
   <handlers>
     <remove name="BlockViewHandler"/>
     <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
     <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
     <remove name="OPTIONSVerbHandler"/>
     <remove name="TRACEVerbHandler"/>
     <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*."
          verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
          type="System.Web.Handlers.TransferRequestHandler"
       preCondition="integratedMode,runtimeVersionv4.0"/>
   </handlers>
 </system.webServer>


below is my controller code :

[HttpPut]
[Route("api/PutEmployeeGenderEmpCode/{_EmpCode}")]

public void PutEmployeeGenderEmpCode(string _EmpCode)
{
    string TempValue = "1";
    SqlConnection Conn = new SqlConnection(ConnectionString);
    CheckConnectionStatus(Conn);
    Conn.Open();

    string SQLCommand = "UPDATE [dbo].[M_EMP_MASTER] ";
    SQLCommand = SQLCommand + "SET ";
    SQLCommand = SQLCommand + "[EMP_GENDER] = '" + TempValue + "' ";
    SQLCommand = SQLCommand + "WHERE [EMP_CODE] = '" + _EmpCode + "'";

    var cmd2 = new SqlCommand(SQLCommand, Conn);
    cmd2.ExecuteNonQuery();

    Conn.Close();
    Conn.Dispose();
}


when call : this is the error show :

http://localhost:44322/api/PutEmployeeGenderEmpCode/502


General
----------
request URL: https://localhost:44322/api/PutEmployeeGenderEmpCode/502
Request Method: GET
Status Code: 405 
Remote Address: [::1]:44322
Referrer Policy: no-referrer-when-downgrade

Response Header
----------------
allow: PUT
cache-control: no-cache
content-length: 92
content-type: application/xml; charset=utf-8
date: Mon, 18 May 2020 08:39:04 GMT
expires: -1
pragma: no-cache
server: Microsoft-IIS/10.0
status: 405
x-aspnet-version: 4.0.30319
x-powered-by: ASP.NET
x-sourcefiles: =?UTF-8?B?QzpcMjAyMFxDQlMyMDAwNCAtIE1PQklMRSAtIFRFU1RcV2ViQVBJXzNcV2ViQVBJM1xXZWJBUEkzXGFwaVxQdXRFbXBsb3llZUdlbmRlckVtcENvZGVcNTAy?=

Request Header
---------------
:authority: localhost:44322
:method: GET
:path: /api/PutEmployeeGenderEmpCode/502
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7
cookie: ai_user=nrUCU|2020-04-23T13:17:35.464Z
sec-fetch-dest: document
sec-fetch-mode: navigate
sec-fetch-site: none
sec-fetch-user: ?1
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36


<error>
<message>
The requested resource does not support http method 'GET'.



Thanks in advance..
AnswerRe: API fail to use PUT method Pin
Richard Deeming18-May-20 1:06
mveRichard Deeming18-May-20 1:06 
Questionasp.net Pin
lankaudaranga16-May-20 22:01
Memberlankaudaranga16-May-20 22:01 
AnswerRe: asp.net Pin
Mycroft Holmes17-May-20 12:14
professionalMycroft Holmes17-May-20 12:14 
Questiondévelopper et utiliser le web service Pin
Member 1483395815-May-20 21:27
MemberMember 1483395815-May-20 21:27 
Questiondévelopper et utiliser le web service Pin
Member 1483395815-May-20 21:27
MemberMember 1483395815-May-20 21:27 
Questioninsert data into list from form and Pin
Member 1322055210-May-20 23:41
MemberMember 1322055210-May-20 23:41 
Rant[REPOST] insert data into list from form and Pin
Richard Deeming11-May-20 3:18
mveRichard Deeming11-May-20 3:18 
QuestionIServiceCollection / DependencyInjection issue Pin
Super Lloyd7-May-20 20:39
MemberSuper Lloyd7-May-20 20:39 
AnswerRe: IServiceCollection / DependencyInjection issue Pin
Richard Deeming10-May-20 22:01
mveRichard Deeming10-May-20 22:01 
GeneralRe: IServiceCollection / DependencyInjection issue Pin
Super Lloyd11-May-20 19:19
MemberSuper Lloyd11-May-20 19:19 
QuestionSet route in net core api Pin
pkfox5-May-20 7:20
professionalpkfox5-May-20 7:20 
AnswerRe: Set route in net core api Pin
Richard Deeming5-May-20 8:41
mveRichard Deeming5-May-20 8:41 
GeneralRe: Set route in net core api Pin
pkfox5-May-20 10:06
professionalpkfox5-May-20 10:06 
AnswerRe: Set route in net core api Pin
jkirkerx7-May-20 8:58
professionaljkirkerx7-May-20 8:58 
GeneralRe: Set route in net core api Pin
pkfox13-May-20 1:07
professionalpkfox13-May-20 1:07 
GeneralRe: Set route in net core api Pin
jkirkerx13-May-20 5:27
professionaljkirkerx13-May-20 5:27 
QuestionSecuring a Web Project Using ASP.Net Pin
MadDashCoder30-Apr-20 20:01
MemberMadDashCoder30-Apr-20 20:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.