我有问题,在我上面的代码中,两个第一页以完美的方式工作,但最后一个只显示一个页面,只有一行代码细节。我需要帮助!!html actionlink的属性
@if (((RegisteredUser)Session["User"]).IsExpert)
{
<li>@Html.ActionLink("Área técnica", "Index", "Dashboard", new { area = "Expert" }, null)</li>
}
@if (((RegisteredUser)Session["User"]).IsServiceDeskAdmin)
{
<li>@Html.ActionLink("Área de administração", "Index", "Dashboard", new { area = "Administration" }, null)</li>
}
@if (((RegisteredUser)Session["User"]).IsExpert)
{
<li>@Html.ActionLink("Perfil", "Index", "PerfilController", new { area = "Perfil" }, null)</li>
}
上面的代码是.cs文件。由于
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Mvc;
namespace Fcebi.ServiceDesk.WebPlatform.Controllers
{
public class PerfilController : Controller
{
// GET: Perfil
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
Fcebi.ServiceDesk.WebPlatform.Areas.Expert.ExpertAuth.DoAuth(Session, Request, filterContext, Url);
}
public ActionResult Index(String Id)
{
// Id = api da tabela User
Id = "Id7dkSro7Qh";
if (String.IsNullOrEmpty(Id) || String.IsNullOrWhiteSpace(Id))
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "O ID do utilizador tem de ser definido");
}
else
{
try
{
RegisteredUser U = RegisteredUser.FindByAPI(Id);
var JsonToReturn = new
{
Name = U.Name,
Departamento = U.Department,
Email = U.Email,
signature=U.Signature
};
return Json(JsonToReturn, JsonRequestBehavior.AllowGet);
}
catch (ServiceDeskException Ex)
{
return new HttpStatusCodeResult((int)Ex.ErrorId, Ex.Message);
}
catch (Exception Ex)
{
new ServiceDeskException(ServiceDeskException.ErrorList.OTHER, Ex);
return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError, Ex.Message);
}
}
}
}
}
你的措词不清楚。你的意思是_link_不能正确显示,或者点击link_呈现的_page不能正确显示?我不知道你的意思是“只有一行代码细节” – ADyson
链接不工作100%,页面没有重定向,当我强制链接去页面只出现一行信息与用户信息,我想显示配置良好的页面,我复制并粘贴工作页面的代码,所以更改了变量和我想显示的内容 –
actionlink的呈现html是什么样子的?这是否对应于应用程序中的真实控制器和操作? – ADyson