ASP .NET Core Double Escape characters in URL

Lou Davis 1 Reputation point
2021-11-16T19:17:11.033+00:00

Greetings I have built an ASP .NET Web API that receives information from Sage Intacct and does some simple calculations and updates a record in Intacct. On IIS this web API worked fine. However, when deployed to an Azure App Service, Azure would return an error that the URL is not found.

Looking at the issue, I determined it is because of the double escape sequence used for the data value in the URL (Example: /meterapi/payments/AESLLC-imp/E-250/11%2F12%2F2021/10252). If I replace the escape characters with dashes (11-12-2021), the call to the web API on Azure works fine.

Again this worked fine in IIS with no issues with no special programming. As Sage Intacct only can provide a date in this format and is not able to send a body with a web API request, is there anyway within the web API to let Azure app services understand to accept the double escape characters such as in the URI snippet above?

Thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,157 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,865 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 26,191 Reputation points
    2021-11-16T19:36:35.463+00:00

    %2F is a slash not a dash. Fix your code to return a date with dashes rather than slashes if that is the format Sage expects.

    string date = DateTime.Now.ToString("MM-dd-yyyy");  
    Console.WriteLine(date);  
      
    //Output  
    //11-16-2021  
    

    Standard date and time format strings
    Custom date and time format strings


  2. ajkuma 22,401 Reputation points Microsoft Employee
    2021-12-03T12:39:14.937+00:00

    To benefit the community, just posting from the private* comments. Also, thanks to AgaveJoe for sharing great insights and suggestions.

    LouDavis-9849, much appreciate your feedback and update on this. "Issue corrected on the Intacct Side. The consultant there figured out how to format the date properly so issue is resolved."