asp.net-mvc-2

Session Timeout Limit in ASP.NET?

天涯浪子 提交于 2019-11-30 16:57:01
问题 I'm amending a Session time out in the Web.Config for an ASP.NET application written in C# and currently I have the timeout set to 120 minutes as shown below: <sessionState mode="InProc" cookieName="Application_SessionId" timeout="120"/> Is there a limit to this value? So if for example I wished to set it to 24 hours (1440 minutes) would this be applied? It's ASP.NET version 4.0 with MVC 2.0 回答1: I am not sure if it makes sense to set the session timeout to 24 hours, but yes it would be

Get a form action/url with jquery

六眼飞鱼酱① 提交于 2019-11-30 16:50:12
How do I get the action url from a form with jquery? JAAulde Get the form, ask for the action attribute: $('#myForm').attr('action'); elbowlobstercowstand Need the full action url instead of just the basename? Generally it's better to use prop() instead of attr() when grabbing these sorts of values. (This prop() vs attr() stackoverflow post explains why.) However, in this instance, @JAAulde answer is exactly what I needed, but not might be what you need. You might want the full action url. Consider this html form start tag: <form action="handler.php" method="post" id="myForm"> attr() returns

setInterval stops after Ajax request

☆樱花仙子☆ 提交于 2019-11-30 16:34:47
I'm using Asp.net MVC and I want my partial view to refresh on an interval, which it does until I make an unrelated Ajax request, then it stops. Here are a few simplified snips to illustrate the problem. in AjaxRefresh.js: function ajaxRefresh() { var f = $("#AjaxForm"); $("#AjaxLoading").show(); $.post(f.attr("action"), f.serialize(), function (context) { $("#AjaxDiv").html(context); $("#AjaxLoading").hide(); }); } setInterval(ajaxRefresh, 1000); in Index.aspx: <script type="text/javascript" src="../../Scripts/AjaxRefresh.js"></script> <div id="AjaxDiv"> <% Html.RenderPartial("Computers",

Need help understanding how Ninject is getting a Nhibernate SessionFactory instance into a UnitOfWork?

限于喜欢 提交于 2019-11-30 16:08:22
问题 So using some assistance from tutorials I have managed to wire up a Nhibernate session to my repositories and my repositories to my controllers using Ninject. However, there is one peice of the setup that I am not grasping the "automagic" of what Ninject is doing and was hoping someone could explain. Below is my Ninject ModuleRepository that inherits from NinjectModule that does all the binding. public class ModuleRepository : NinjectModule { public override void Load() { var helper = new

Asp.Net MVC - Refresher Course

人走茶凉 提交于 2019-11-30 16:03:27
问题 When MVC first came out, I was reading about it everyday and learning all I could about it. About the time MVC 2 RC2 came out, I stopped learning for various reasons (new house, new job, laziness). I now want to get back into MVC ... I have a half written blog that I want to finish, but I feel rusty when it comes to anything MVC. Can anyone provide me some good links to refresher courses on MVC? I don't need to learn from scratch, but I want to refresh, then learn about changes from MVC 2 RC2

ASP.Net MVC - Handle Multiple Checkboxes

邮差的信 提交于 2019-11-30 15:57:56
问题 Ok, I have a role based permission system in place and would like admin's to be able to edit the permissions for each role. To do this I need to load lots of checkboxes, however I'm struggling with getting the return data from the View Please Note: I have looked around, I have found similar questions but as of yet cannot find a solution. <% Html.BeginForm(); string lastGroup = ""; foreach (var CurPermission in Model) { %> <%=Html.CheckBox("Permissions", CurPermission.Checked, new { ID =

How do I encrypt URLs in ASP.NET MVC?

丶灬走出姿态 提交于 2019-11-30 15:51:48
问题 I need to Encrypt the URLs in my ASP.NET MVC application. Do I need to write the code in Global page in Route Collection to Encrypt all the URLs? 回答1: It's a bad idea to encrypt a URL. Period. You may wonder why I say that. I worked on an application for a company that encrypted its URLs. This was a webforms application. From the URL alone, it was nearly impossible to tell what part of the code I was hitting to cause that issue. Because of the dynamic nature of calling the webform controls,

Asp.Net MVC - Refresher Course

陌路散爱 提交于 2019-11-30 15:49:54
When MVC first came out, I was reading about it everyday and learning all I could about it. About the time MVC 2 RC2 came out, I stopped learning for various reasons (new house, new job, laziness). I now want to get back into MVC ... I have a half written blog that I want to finish, but I feel rusty when it comes to anything MVC. Can anyone provide me some good links to refresher courses on MVC? I don't need to learn from scratch, but I want to refresh, then learn about changes from MVC 2 RC2 to MVC 3. EDIT: Anyone know an ETA on when MVC 3 is going to release? Should I convert my current MVC

Correct 404 message for a missing ASP.Net MVC controller

删除回忆录丶 提交于 2019-11-30 15:48:45
I have an MVC 2 application that should always give a 'nice' 404 page. However currently I get a low level .Net one: "Server Error in '/sitename' Application..." I have a base controller that has a NotFound action that will render the nice 404 page. Missing actions are handled: protected override void HandleUnknownAction(string actionName) { this.NotFound(actionName).ExecuteResult(this.ControllerContext); } So a visit to {site}/ValidController/NotAnAction gets routed correctly. However a visit to {site}/NotAController doesn't. I have routes set up with a catch all: routes.MapRoute( "MVC routes

Inline client side validation with MVC and jQuery

穿精又带淫゛_ 提交于 2019-11-30 15:43:58
I have setup a simple example to show a form inside a jquery UI dialog and wish to enable inline client side validation on that form I have then added the scripts to my master page <script type="text/javascript" src="<%: Url.Content( "~/_assets/js/jquery-1.4.3.min.js" )%>"></script> <script type="text/javascript" src="<%: Url.Content( "~/_assets/js/jquery.validate.min.js" )%>"></script> <script type="text/javascript" src="<%: Url.Content( "~/_assets/js/MicrosoftMvcJQueryValidation.js" ) %>"></script> and then I have enabled Client Side Validation through the following code <% Html