Asp.net web api WebApi调用中的转义字符

Asp.net web api WebApi调用中的转义字符,asp.net-web-api,Asp.net Web Api,我有一个非常奇怪的问题,我不能发布任何带有句号的文本。以下是我的ajax调用的url: url = 'BIReports/SaveReport/' + reportDescription; 如果reportDescrption中有句点,则不会发布。想法?如中所述,您可能希望尝试将relaxedurltofilessystemmapping设置为true <configuration> <system.web> <httpRuntime relaxedU

我有一个非常奇怪的问题,我不能发布任何带有句号的文本。以下是我的ajax调用的url:

url = 'BIReports/SaveReport/' + reportDescription;
如果reportDescrption中有句点,则不会发布。想法?

如中所述,您可能希望尝试将
relaxedurltofilessystemmapping
设置为
true

<configuration>
  <system.web>
    <httpRuntime relaxedUrlToFileSystemMapping="true"/>

    <!-- ... your other settings ... -->
  </system.web>
</configuration>


让我稍微修改一下。如果它以句号结束,则它不会发布。它可以在文本的任何地方有一个句号,除了结尾。不明白。如果你像那样将字符串直接连接到URL中,那么最好使用HttpServerUtility.UrlEncode来避免特殊字符的问题——请注意,“.”不是特殊字符,Maggie Ying的上述答案仍然是该问题的答案。