///
/// 檢查特定Controller和Action是否存在
///
///控制器名稱
///動作名稱
///
public static bool IsControllerAndActionExist(string controller, string action)
{
var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
Type[] types = executingAssembly.GetTypes();
Type type = types.Where(t => t.Name == controller + "Controller").SingleOrDefault();
if (type != null && type.GetMethod(action) != null)
{
return true;
}
return false;
}
文章標籤
全站熱搜
