asp.net-mvc-2

What is the difference between [AcceptVerbs(HttpVerbs.Post)] and [HttpPost]?

混江龙づ霸主 提交于 2019-11-27 10:13:05
问题 I can decorate an action either with the [AcceptVerbs(HttpVerbs.Post)]/[AcceptVerbs(HttpVerbs.Get)] [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(string title) { // Do Something... } or with the [HttpPost]/[HttpGet] attributes [HttpPost] public ActionResult Create(string title) { // Do Something... } Are they different? 回答1: Nothing. One is just shorthand for the other. 回答2: [HttpPost] is shorthand for [AcceptVerbs(HttpVerbs.Post)] . The only difference is that you can't use

asp.net mvc azure “Error accessing the data store!”

拥有回忆 提交于 2019-11-27 09:33:47
I've started using the AspProviders code to store my session data in my table storage. I'm sporadically getting the following error: Description: Exception of type 'System.Web.HttpException' was thrown. INNER_EXCEPTION:Error accessing the data store! INNER_EXCEPTION:An error occurred while processing this request. INNER_EXCEPTION: ConditionNotMet The condition specified using HTTP conditional header(s) is not met. RequestId:0c4239cc-41fb-42c5-98c5-7e9cc22096af Time:2010-10-15T04:28:07.0726801Z StackTrace: System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar) System.Web

Using cookie in asp.net mvc c#

◇◆丶佛笑我妖孽 提交于 2019-11-27 09:25:45
问题 I want to register the parameter of a few pages in my web site using cookie. I tried the below code but not like what I want : public ActionResult Index(int? dep, int? cat) { ...... string theDept = Request.QueryString["dep"]; HttpCookie cookie = new HttpCookie("search"); cookie.Values["dep_name"] = theDept; cookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); return View(); } I read it in site.master : <% HttpCookie cookie = Request.Cookies["search"] ; if ((cookie != null)

What is the best option for transcribing speech-to-text in a asp.net web app?

喜欢而已 提交于 2019-11-27 09:21:23
I am building a web app for recording voice messages and am looking for the best options for converting the voice messages to text. Does anyone have some suggestions on what to use to make the conversion? Would System.Speech work? Michael Levy System.Speech is a client focused API. Vista and Windows 7 include the speech engines for System.Speech. You could use this for transcription because the client speech engines provided by Microsoft include a dictation grammar. The server speech engines provided by Microsoft do not include a dictation grammar, so they are more difficult to use for

How to call function on timer ASP.NET MVC

只愿长相守 提交于 2019-11-27 09:20:58
问题 I need to call function on timer (lets say onTickTack() function) and reload some info in ASP.NET MVC project. I know that there are several ways to do that, but which one is the best by your opinion? Note: the function should be called from one place only, and should be called every X mins till application is up. EDIT 1: Reload some info - for example I have something in the Cache and I want to update it from DB on timer - once a day in certain time. 回答1: The answer to this question would

ASP.NET-MVC2 Preview 1: Are There Any Breaking Changes?

浪尽此生 提交于 2019-11-27 08:52:36
问题 I was following Steven Sanderson's 'Pro ASP.NET MVC Framework' book. On page 132, in accordance with the author's recommendation, I downloaded the ASP.NET MVC Futures assembly, and added it to my MVC project. Then, without encouragement from the author , I downloaded, installed, and incorporated the ASP.NET MVC2 Preview 1 dlls into my project. Now, I can no longer load the website. That is, when I hit F5 in Visual Studio, I get this error. In retrospect, I think it was a really bad idea to

Firefox 6 Infinite Page Refresh With Page With Hash Tags

谁说我不能喝 提交于 2019-11-27 08:12:29
When Firefox updated to version 6 recently, a site I'm working on severely broke. The site operates normally when browsing to any page without a hash tag but if you try to navigate to a page with a hash tag (e.g. #test ) or refresh the page once a hash tag was applied, the page refreshes as quickly as it can infinitely. This is a Asp.Net MVC 2 site created around a year and a half ago. frank hadder Turns out, this is an issue with an old version of MicrosoftAjax.js (the one that comes installed with Asp.Net MVC 2). Open up the MicrosoftAjax.debug.js file and check the file version number. The

Unable to set membernames from custom validation attribute in MVC2

独自空忆成欢 提交于 2019-11-27 07:41:30
问题 I have created a custom validation attribute by subclassing ValidationAttribute. The attribute is applied to my viewmodel at the class level as it needs to validate more than one property. I am overriding protected override ValidationResult IsValid(object value, ValidationContext validationContext) and returning: new ValidationResult("Always Fail", new List<string> { "DateOfBirth" }); in all cases where DateOfBirth is one of the properties on my view model. When I run my application, I can

JavaScriptSerializer not deserializing DateTime/TimeSpan Properly

懵懂的女人 提交于 2019-11-27 07:28:40
问题 Having a problem where DateTime/TimeSpan doesn't seem to deserialize properly with JavaScriptSerializer. When I get the Object back after deserializing the TimeSpan is empty and if I use DateTime then the times are all out of whack. Did find this article but it didn't really help me too much. http://www.west-wind.com/weblog/ShowPost.aspx?id=471402 Anyone have any ideas? Should I maybe try the json.net library? public class JsonFilter : ActionFilterAttribute { public string Param { get; set; }

ASP.Net MVC 2 Controller's TryValidate doesn't validate the List<> items within the model

倾然丶 夕夏残阳落幕 提交于 2019-11-27 07:11:21
问题 How do you get a model's validation to also validate child objects in a generic list property. I have a model that I'm trying to validate, this is not what's being posted to the server, but a composite of some information posted, and information already on the server... for example. ... public class A { [Required] public string Property1 { get; set; } } ... public class B { public List<A> Values { get; set; } } ... if (!TryValidateModel(instanceofB)) { //this should fire, as one of A inside B