Skip to main content

Posts

Error 405 : ASP.NET Core Web API PUT and DELETE Methods not allowed

Recently while working with .Net core API I came across the issue of “Error 405 – Methods not Allowed”
After some research I found out that both GET and POST requests working fine but neither PUT nor DELETE requests working. Another thing is PUT and DELETE request was also working fine on my local machine but failing when we host on our Azure server.
When I explored about the issue on web it led me to conclusion that WebDAVModule seems to set PUT and DELETE request methods disabled by default and due to that PUT and DELETE throws 405 error.
To make the PUT and DELETE requests work, we need to override WebDAVModule setting in web.config file by adding below settings under “system.webServer”.

<system.webServer> <modulesrunAllManagedModulesForAllRequests="false"> <removename="WebDAVModule" /> </modules> </system.webServer>

There may be 2 web.config files in your project, if that is the case then update the one that is inside the wwwroot fold…
Recent posts

C#: Geocoding to get Latitude and Longitude using Google Maps API

Geocoding is the process of getting the latitude and longitude of an address or set of addresses, which you can use to place markers or position the map.
Geocoding can be done on client side as well as on server side, based on your requirements you need to choose one out of both options.
For geocoding I am using Google Maps API which is quite reliable and faster in response to other geocoding APIs.
You can check the JSON response by directly running the API with address on browser window or you can take service of POSTMAN as well. Sample JSON response of Google Map API is given below:
Requested geocoding of “Gurgaon” using Google Maps API Request: http://maps.googleapis.com/maps/api/geocode/json?sensor=true&address=Gurgaon Response: { "results" : [        { "address_components" : [               { "long_name" : "Gurgaon", "short_name" : "Gurgaon", "types" : [ "locality", "political" ]               },     …

SQL Server: Storing language specific data in SQL Server table field.

While working on multi language support we need to insert different language data in same field or different fields of a SQL server table.
There are two basic rules one need to keep in mind while storing multi lingual or Unicode data: ·First is column must be of Unicode data type (i.e., nchar, nvarchar, ntext). ·And second is that the value must be prefixed with N while insertion.
Below is the sample script with output to understand it better. USEMASTER GO -- Drop and Create TestMultiLingualDB IFdb_id('TestMultiLingualDB')ISNOTNULL DROPDATABASE TestMultiLingualDB GO SETNOCOUNTON GO CREATEDATABASE TestMultiLingualDB GO USE TestMultiLingualDB GO CREATETABLE MultiLanguage(Id INT, Var_Field VARCHAR(50), NVar_Field NVARCHAR(50)) GO -- Insert Hindi Characters INSERTINTO MultiLanguage VALUES (1,N'यहएकशब्दहै',N'यहएकशब्द