Asp.net 3.5 IIS 7 NHibernet www.sample.com 網站中的虛擬目錄託管ASP.NET MVC 2.0 IIS 7.0和404錯誤
其生成的URL,如「/樣品/首頁/指數「而不是‘/首頁/指數’
好,應用程序正與上述網址,但是當我打電話一樣casecade dropdwonlist任何Ajax的數據,我回到404
操作都工作正常,但只有當我返回Json(數據)它返回404. 我試過wi TH GET和POST
代碼
[HttpPost]
public ActionResult GetSubCategories2(int id)
{
var data = from subCat in CategoryService.GetChildByParentCategory(
CategoryService.GetCategoryByID(id))
select new { Value = subCat.ID, Text = subCat.CategoryName };
return Json(data);
}
我有一個安全過濾&錯誤處理程序
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method
, Inherited = true, AllowMultiple = false)]
public class HandelRecordNotFound : HandleErrorAttribute
{
public override void OnException(ExceptionContext filterContext)
{
if (filterContext.Exception.Message.IndexOf("No row with the given identifier exists") > -1)
{
//filterContext.HttpContext.Response.Redirect("~/Admin/InvalidRequestOrRecordNotFound");
filterContext.Result = new RedirectResult("~/Admin/InvalidRequestOrRecordNotFound");
filterContext.ExceptionHandled = true;
}
if (filterContext.Exception.Message.IndexOf("The DELETE statement conflicted") > -1)
{
//filterContext.HttpContext.Response.Redirect("~/Admin/InvalidRequestOrRecordNotFound");
filterContext.Result = new RedirectResult("~/Admin/InvalidRequestOrRecordNotFound");
filterContext.ExceptionHandled = true;
}
//filterContext.Exception.Message
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method
, Inherited = true, AllowMultiple = false)]
public class AdminAuthorization : AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
base.AuthorizeCore(httpContext);
object userTypeObject = httpContext.Session["UserType"];
if (userTypeObject == null ||
(UserTypes)Enum.ToObject(typeof(UserTypes), userTypeObject) != UserTypes.Administrator)
{
return false;
}
return true;
}
}
除了以上每一件事情是正常的。
在客戶端,但是,JsonResult方法返回錯誤404
沒有我的客戶主要網站上運行的根,所以我不能將其移動到根。我通常在我自己的域名中展示我的工作,像「http://client.wayzsoft.com」這樣的子域名,因爲我從未在生成的Url中找到「wayzsoft」或「client」。就像我想的那樣,即使是子域也被託管爲虛擬目錄。第二我有問題與JsonResult不與ActionResult和內容 – 2010-12-04 09:22:00