无法在控制器中返回值?

时间:2018-07-09 05:08:12

标签: asp.net-web-api

这是我的GetMethod,GetStakeholder()方法,应该存储了值或出现了(参数= {“ action”:“ ITEM_LIST”,“ bio_access_id”:“ 121314”}),但不存储/获取值sParam ..

public class huhu : ApiController
{        
    [HttpGet]
    [ActionName("GetStakeholder")]
    public string GetStakeholder()
    {                             

            StringWriter sw = new StringWriter();

            using (JsonWriter writer = new JsonTextWriter(sw))
            {
                writer.Formatting = Formatting.None;

                writer.WriteStartObject();

                writer.WritePropertyName("bio_access_id");
                writer.WriteValue(UserSession.bio_access_id);


                writer.WritePropertyName("action");
                writer.WriteValue("ITEM_LIST");

                writer.WriteEndObject();
            }

            string sParam = "param=" + sw.ToString();// HttpUtility.UrlEncode(sw.ToString());

        return sParam;          


    }

}

}

0 个答案:

没有答案