Asp.net mvc 4 从CRM单击按钮打开MVC应用程序

Asp.net mvc 4 从CRM单击按钮打开MVC应用程序,asp.net-mvc-4,routing,actionresult,Asp.net Mvc 4,Routing,Actionresult,我正在制作一个MVC4应用程序,它显示来自CRM的数据 public ActionResult Index(string id) { MyApplication.Data.ResourceData resourceData = new MyApplication.Data.ResourceData(); var resource1 = resourceData.showResource(id); return View(resource1); //r

我正在制作一个MVC4应用程序,它显示来自CRM的数据

public ActionResult Index(string id)  
{  
    MyApplication.Data.ResourceData resourceData = new MyApplication.Data.ResourceData();  
    var resource1 = resourceData.showResource(id);

    return View(resource1);
    //return View();
}
我在CRM中创建了一个按钮,当我单击该按钮时,我将获得Id 获取urlwww.MyApplication.com?123456其中123456是CRM中数据的Id

现在,如何解析数据以打开我的应用程序


我的意思是如何告诉我的MVC应用程序之后取字符串?并作为需要在索引中传递的Id。

您需要向url添加一个键。将其更改为www.MyApplication.com?id=123456。然后在你的控制器里

public ActionResult Index(string id){...} 
应该捕获id。如果这不能提取id,那么Request.QueryString[“id”]也应该获取它。希望这能有所帮助