在我的ASP.NET MVC 3中,我正在使用此代码
<a href=@url.Action("myController", "myaction")>
Run Code Online (Sandbox Code Playgroud)
但是当我点击它时,它不会去我的行动.相反,在URL中我看到了这一点
http://localhost:1402/?Length=2
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
谢谢.
编辑:
这是我的路线:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
Run Code Online (Sandbox Code Playgroud) 我有一个有两个应用程序的解决方案.是否可以让用户只登录一次?
例如,在主应用程序中,我执行如下身份验证:
FormsAuthentication.SetAuthCookie(ContactFound.ContaLogin, model.RememberMe);
Run Code Online (Sandbox Code Playgroud)
我把这段代码放在web.config文件中:
<authentication mode="Forms">
<forms
loginUrl="~/Account/LogIn"
defaultUrl="~/Account/LogOn"
timeout="15"
/>
</authentication>
Run Code Online (Sandbox Code Playgroud)
我应该添加什么,以便当用户登录时,在主应用程序中,当他连接到第二个应用程序时,我们不会要求他再次登录?
我正在开发评级问题的页面.
在视图中,我有一个问题列表和每个问题前面的5个单选按钮.
<input name="evalId" type="hidden" value="@Model.Evaluation.EvalId" />
foreach (var question in questionList)
{
<input name="questionId" type="hidden" value="@question.QuestionId" />
<div class="row_star" style="border-bottom : 0 none; background: none;">
@if (!String.IsNullOrEmpty(question.QuestionTitre))
{
<p>@question.QuestionTitre.TrimEnd()</p>
}
@* here goes the code for 5 radio buttons*@
}
Run Code Online (Sandbox Code Playgroud)
现在,在我的控制器中,我希望能够知道每个问题检查了哪个单选按钮.
我怎样才能做到这一点 ?
这是我的ViewModel
public class EvaluationViewModel
{
/// <summary>
///
/// </summary>
public EvalEvaluation Evaluation
{
get;
set;
}
/// <summary>
///
/// </summary>
public Dictionary<EvalQuizz, List<EvalQuestion>> EvalQuizzQuestionList
{
get;
set;
}
}
Run Code Online (Sandbox Code Playgroud) 是否可以从另一个DateTime中减去一个DateTime并在Time中得到结果.例如,如果我们从2011-08-29 08:13:00 UTC减去2011-08-27 01:00:00 UTC,结果应该是55:13:00(希望我在计算时没有犯错:p ) 谢谢.
我有一个ASP.NET MVC 3应用程序,我想在其中导入excel文件.
我设法使用linq-to-excel库来做到这一点.但是当我在IIS上部署应用程序时,我得到了一个错误,结果是IIS在64位系统上运行.
这可以通过32-bits applications在IIS中启用池的选项来解决.
这会影响应用程序的性能吗?如果是,是否有另一种替代方案linq-to-excel可以在64位上运行.
我有这个Linq查询工作正常
var test = (from c in context.ConsumptionSet
join pi in context.PropertiesInstanceSet on c.PropertiesInstanceID equals pi.PropertiesInstanceID
join ep in context.EquipmentPropertiesSet on pi.EquipmentPropertiesID equals ep.EquipmentPropertiesID
where (ep.EquipmentID == equipmentId && pi.ProprietesName == ProprietesName.Energy && c.Date <= DateTime.Today && c.Date >= EntityFunctions.AddDays(DateTime.Today, -7))
group c by c.Date.Day into grp
select new
{
test = grp.Key,
value = (from c2 in grp select c2.Value).Max()
}).ToList();
Run Code Online (Sandbox Code Playgroud)
但我想这组由结果的DayOfWeek属性,而且好像LINQ的不允许这样做,因为当我代替我得到这个错误group c by c.Date.Day的group c by c.Date.DayOfWeek:
The specified type member 'DayOfWeek' …
我在jquery中声明了这个变量
var enabled = false;
Run Code Online (Sandbox Code Playgroud)
我想在我的Html hepler参数的Html页面中使用它,就像这样
@Html.ListMultiple(enabled)
Run Code Online (Sandbox Code Playgroud)
但是这段代码不起作用,因为Html不知道变量,因为它是在jQuery中声明的.