asp.net-mvc

Error during JSON request

Hi, I have a JSON request that check to the server if a username has been already taken during the registration procedure. This is the jQuery call: // Instant check availability of the username $("#txtUserName").blur(function() { if ($("#txtUserName").val() == "") return; $.ajax({ type: 'post', url: '/Login/Chec...

ASP.NET MVC not submitting in Internet Explorer

$('#btn').submit(function () { $('#btn').attr("disabled", "disabled"); setTimeout('enableButton()', 500); return true; }); function enableButton() { $('#btn').removeAttr('disabled'); } How can I submit the form in Internet Explorer? ...

Hosting ASP.net application from WCF

Is it possible to host an ASP.net (MVC in particular, but I'm not sure if that's important) application from a self-hosted WCF service? I don't want to get into IIS, and I'd like to avoid something like Cassini if possible. Sorry if this is a duplicate, it's really hard to find questions on this (everything is WCF on ASP, not the other ...

jQuery event sequence ....

Hello, I have a main screen with 2 parts a list and a detail section. Via a button, I open a modal dialog. On this modal dialog, 2 buttons one for save and the other for cancel. After the save, I call a function to refresh the list on the main screen and close the dialog. The problem, sometimes, the list is refresh before the end of the...

Is Data Annotations really a good idea for validation?

As I'm learning more and more about ASP.NET MVC the more I am introduced to Data Annotations. Specifically in MVC they are used for validation and this gives me some concerns. The biggest is due to the fact that I like to keep my model as POCOs and as clean as possible. Now what if I have those model classes shared across multiple projec...

Using the Razor view engine in a different way.

I thought it would be interesting if I could use the new MVC Razor View engine as a mail merge technology. It can still be part of an MVC website and does not have to be stand-alone console app. Example: string myTemplate = "Hello @Name, How are you today?"; ViewModel.Name = "Billy Boy"; string output = RazorViewEngineRender( myTemp...

ASP.NET routing - avoiding clashes between controller/action and vanity/slug urls

I'm looking for a good solution to having a URL scheme that works for both standard ASP.NET MVC controller/action urls eg: /Home/About --> Controller "Home", Action "About" and vanity/slug urls eg: /fred/post --> Controller "Posts", Action "View", User "fred", Post "post" Importantly, I want the outbound url generation to work so ...

Model Binding to view in MVC

Hi Team, I am a beginner to MVC and would like to know how I can set by binded model vaule back for viewing. Here is the example. public class DataTypes { public Guid ItemID { get; set; } [Required()] public string Name { get; set; } [Required()] public string Status { get; set; } [Required()] public DataMod...

Copy Local != true System.Web.MVC - Asp.net MVC 2 Dictionary Error in Controller Before Action

I am getting an odd error in an ASP.NET MVC (mvc dll version 2.0.0.0) project after the server is under load (50 to 100 requests per second) for a few hours and cache is approaching its memory limit. If I am reading the error log right (we use elmah) the MVC action parameter parser is failing before it gets to my controller's action. ...

Why did Scott Guthrie suggest us to use a random, small sleep delay in a Error.aspx?

I cannot figure out, how can a random, small sleep delay can be a solution to prevent an attacker from probing our site. This is his code snippet: <%@ Page Language="C#" AutoEventWireup="true" %> <%@ Import Namespace="System.Security.Cryptography" %> <%@ Import Namespace="System.Threading" %> <script runat="server"> void Page_Load() {...

How to show this Success message on popup .

I have this code in my view. After my database adding the message is showing perfectly but my Grid is not showing the updated result. If I keep return true; when I click Submit button I am getting popup window immediately and then adding to the database? This showing my updated result in the grid. ...

Rss20FeedFormatter is producing RSS that is not well formed

I am using ASP.Net MVC2 and have a RSS feed for my blog. I am using out of the box functionality in System.ServiceModel.Syndication and Rss20FeedFormatter. The feed works fine and can be read by Outlook as well as every browser I have tried. However when I submitted the RSS feed to google as a sitemap I got validation errors. Out of cu...

Changing connectionstring for entity framework after IIS7 MVC Publish results in metadata error

I built this app with Web Developer Express 2010 using SQL Server Express 2008. I downloaded mdf/log files from my server to my local and attached them as a database with SQL 2005 compatibility. I'm now trying to publish to my production server. The server is using SQL Express 2005 and Windows Server Web. I tried to change out the web.c...

Prevent updating unchanged value in ASP.NET MVC and Entity Framework

I am using ASP.NET MVC and Entity Framework. I have an Edit Person web page where person's fields can be edited, then in the post back action, I use the following code. var person = objectCtx.Persons.Where(s => s.Id == id).FirstOrDefault(); TryUpdateModel(person, form.ToValueProvider()); objectCtx.SaveChanges(); It works great. Howeve...

JQuery UI Autocomplete with .Net MVC: How to display the label when selected but save the value.

I have implemented Autocomplete and I'm having trouble with the label vs. value in the text box after the item is selected. When I type in a zip code, I see the label in the dropdown: but after I select one, instead of the label showing in the text box, the value (which is the ID that needs to be saved to the database) is displayed: ...

jQuery DataTables Show and hide details feature using MVC

Hello. Is there a simple and clear example that shows how to use show/hide details about particular record feature of dataTables jQuery plug-in with MVC? If you have implemented this stuff and may share it with me, I would greatly appreciate it. Thank you for your help! ...

can we instruct global.asax.cs file to open only one page from Address bar

i want that browser will accept request for only login page all other request should not be acceptable . actually i don't want to check that user is login or logged out from site with Authorize attribute. i just want to disable all requests of web pages(URL's) except login page from site. something like: routes.MapRoute( ...

ASP.NET MVC editor template javascript location

Hi, We have an editor template that contains approx 40 lines of jquery. I tried dropping this script into a <asp:Content> block to keep all of the javascript in one location within the page. However, I get the following error message content controls have to be top-level controls in a content page. Is there any way to get this workin...

binding events in jquery to replaced html

I'm building a jquery plugin for use in my projects in editing items in a table. When a user clicks on an item to edit, I do a pop-up form where they then save the data. When the save is successful I return the new data as a html row and replace the old row with this new returned row, but then I have to rebind the events. I can't figure ...

How to Create a Custom Container in ASP.NET

I am not sure if I have this right ... but can anyone point me to a resource that shows how to create a custom container in ASP.NET (Specifically MVC). By container I am talking about a container that is globally available during a session like a DI container (i.e. Ninject or UNity). Thanks in advance. ...