asp.net-mvc-2

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

旧时模样 提交于 2019-11-27 04:01:14
问题 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? 回答1: 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

MVC - change model's value in view on post [closed]

自古美人都是妖i 提交于 2019-11-27 03:47:40
问题 I have view which displays some data from model. I have submit button which onClick event should change model's value and I pass model's with different values but my values in TextBoxFor stay the same as they were on page load. How can I change them? 回答1: That's how HTML helpers work and it is by design. They will first look in the POSTed data and after that in the model. So for example if you have: <% using (Html.BeginForm()) { %> <%= Html.TextBoxFor(x => x.Name) %> <input type="submit"

MVC2 Cookieless Session Issue using POST

对着背影说爱祢 提交于 2019-11-27 03:39:21
问题 For some reason with cookieless session enabled in MVC2, the session id in the query string is reset with every form post that happens. Is there a special route that needs to be setup for this to work? Are there any other gotcha's I need to be aware of? Thanks. 回答1: Cookieless sessions do work in MVC2, however, you cannot use POST as the method for the form submit. It only supports the use of GET. Also, all of the action paths on the forms need to be updated to the following pattern: <form

Best practice for ASP.NET MVC resource files

ⅰ亾dé卋堺 提交于 2019-11-27 03:34:23
What are the best usage of the following resource files. Properties → Resources ( Phil used this resource for localization in DataAnnotation) App_GlobalResources folder App_LocalResources folder I also would like to know what is the difference between (1) and (2) in asp.net mvc application. Ryan Rivest You should avoid App_GlobalResources and App_LocalResources . Like Craig mentioned, there are problems with App_GlobalResources / App_LocalResources because you can't access them outside of the ASP.NET runtime. A good example of how this would be problematic is when you're unit testing your app.

Extending the MVC RequiredAttribute

久未见 提交于 2019-11-27 03:27:40
问题 I have an extended class of RequiredAttribute that doesn't send error messages back. If I check it in the debugger the text is there alright. public class VierRequired : RequiredAttribute { public VierRequired(string controlName) { //... } public string VierErrorMessage { get { return ErrorMessage; } set { ErrorMessage = value; } } // validate true if there is any data at all in the object public override bool IsValid(object value) { if (value != null && !string.IsNullOrEmpty(value.ToString()

Stop the tag builder escaping single quotes ASP.NET MVC 2

末鹿安然 提交于 2019-11-27 03:19:29
问题 I have the following HtmlHelper method that I want to create a button that does a redirect with JavaScript: public static string JavaScriptButton(this HtmlHelper helper, string value, string action, string controller, object routeValues = null, object htmlAttributes = null) { var a = (new UrlHelper(helper.ViewContext.RequestContext)) .Action(action, controller, routeValues); var builder = new TagBuilder("input"); builder.Attributes.Add("type", "submit"); builder.Attributes.Add("value", value)

Jquery validation - allow number without the leading zero?

痴心易碎 提交于 2019-11-27 03:18:18
问题 I'm using jquery validation (http://docs.jquery.com/Plugins/Validation) like so: var $__field = $("#selector"); if ($__field.is(":visible")) { $__field.rules('add', { required: true }); $__field.rules('add', { number: true }); } If the user enters a number without a leading zero, eg .5 then jquery validation says "Please enter a valid number." How can I change the validation to allow number entry without requiring the leading zero? 回答1: The problem is with the regular expression used for

how to gzip content in asp.net MVC?

£可爱£侵袭症+ 提交于 2019-11-27 03:17:39
how to compress the output send by an asp.net mvc application?? jim tollan Here's what i use (as of this monent in time): using System.IO.Compression; public class CompressAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { var encodingsAccepted = filterContext.HttpContext.Request.Headers["Accept-Encoding"]; if (string.IsNullOrEmpty(encodingsAccepted)) return; encodingsAccepted = encodingsAccepted.ToLowerInvariant(); var response = filterContext.HttpContext.Response; if (encodingsAccepted.Contains("deflate")) { response

Get DisplayName Attribute without using LabelFor Helper in asp.net MVC

那年仲夏 提交于 2019-11-27 03:02:44
What is the best way to retrieve the display name attribute for an item in your model? I see a lot of people using the LabelFor helper for everything, but a label isn't appropriate if I just want to list the data out. Is there an easy way just get the Name Attribute if I just want to print it out in, say a paragraph? <p> <%= Html.Encode( ModelMetadata.FromLambdaExpression<YourViewModel, string>( x => x.SomeProperty, ViewData).DisplayName ) %> <p> Obviously in order to avoid the spaghetti code it is always a good idea to write a helper: public static class HtmlExtensions { public static

ASP.NET MVC - Authenticate users against Active Directory, but require username and password to be inputted

余生颓废 提交于 2019-11-27 02:42:00
I'm developing a MVC3 application that will require a user to be authenticated against an AD. I know that there is the option in MVC3 to create an Intranet Application that automatically authenticates a user against an AD, but it uses Windows Authentication and automatically logs them on. This application may be accessed on 'Open' workstations where the user will need to enter their Domain Username and Password. Any examples or online tutorial would be great. An example project would be exceptional. Khepri You can use the standard Internet application template with forms authentication and