java 可忽略参数_如何使用“&var =”忽略URL参数
我在控制器中作為可選參數(shù):
GetPostalCodeLocation(string postalCode, string postalCodeExt, string place = "", string district = "")
如果在URL我沒有把它區(qū)域工作,但在應(yīng)用程序中生成此URL:
Url:"http://localhost:62814/Api/Address/PostalCodeLocation?postalCode=2415&postalCodeExt=021&place=&district=Leiria"
我無法控制URL(由平臺(tái)定義)
可以在路由集 &place= 中忽略嗎?謝謝
UPDATE 我有這個(gè)動(dòng)作過濾器
Dictionary logParameters = new Dictionary();
logParameters = new Dictionary();
actionContext.Request.Properties.Add(new KeyValuePair("watch", watch));
actionContext.Request.Properties.Add(new KeyValuePair("action", actionName));
Create integer parameter.
foreach (var param in actionContext.ActionArguments)
{
if (param.Value == null)
{
throw new Exception("Parameter " + param.Key + " cannot be null");
}
{
logParameters.Add(param.Key, param.Value.ToString());
}
}
actionContext.Request.Properties.Add(new KeyValuePair("logParameters", logParameters));
base.OnActionExecuting(actionContext);
總結(jié)
以上是生活随笔為你收集整理的java 可忽略参数_如何使用“&var =”忽略URL参数的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Gurman:苹果计划将 MicroLE
- 下一篇: 端午节股票市场是否休市,休市3天