asp.net-mvc

ASP.NET MVC vs WebForms: speed and architecture comparison

I had an argument with one of my friends who is an architect at a pretty large internet company. Basically he was saying that ASP.NET MVC is not for large-scale enterprise applications, that it is not as flexible as WebForms, and that an MVC app will be slower than a web forms app. From my own experience working with MVC, I can say tha...

ASP.NET MVC AJAX Sys is undefined error

I am getting a "Microsoft JScript runtime error: 'Sys' is undefined" error on one of my pages in an MVC application when I attempt an AJAX call. The AJAX call is made from a partial view which is embedded in more than one page. It works fine on all of the pages except one. I have read posts pointing to the web.config file settings and...

How Can I Verify A Download Has Been Completed?

We're using ASP.NET MVC and our action does this: pull records from DB mark records as downloaded push zipped download to browser Now the problem comes when the download doesn't complete for some reason - maybe the user clicks "Cancel" or IE pops up that download security bar. I'm wondering if there's an alternative solution. Could...

How to authenticate users entering Dynamic Data admin area in ASP.NET MVC site?

Hello! I have an ASP.NET MVC 1.0 front-end site that is working well, and features as part of it, a Dynamic Data section that I'm using as the back-end admin area for the site. I haven't messed about too much with authentication yet, but this seems like quite a logical web-site design for any new .NET sites being put together these da...

Nerd dinner, possibly an extreme noob question, list dinners

I am trying to get NerdDinner to work, and having a bit of trouble. I have quick watched at the point where the actionResult for index happens, and seen that the items from the dinnerRepository are on the right side of the asignment operator. However it seems when I step through to the next line of the code, dinners, which is passed to...

Is there another way to create a contract for a LINQ-to-SQL model class?

I have two classes, for this example, that are partial classes against LINQ-to-SQL model classes. public partial class Foo { public bool IsValid { get { return (GetRuleViolations().Count() == 0); } } public IEnumerable<RuleViolation> GetRuleViolations() { yield break; } partial void OnVal...

What is wrong when I get "Internal Server Error" returned from a jquery $.ajax call on an ASP.NET MVC project?

Here is my ajax call: response = $.ajax({ type: "POST", url: "/Row/getRowName", dataType: "json", data:({ currRow : rowName, offset : 5 }), error:function(request){alert(request.statusText)}, success:function(result){alert(result)} }).responseText; I get I...

Can you call a method from a Controller if the View was created from a different Controller?

Say I called Index() from the HomeController which returns the view Index.aspx, can jquery ajax in javascript on Index.aspx call a method in another controller (ExternalController)? $.ajax({ type: "POST", url: "/Home/sayHi", dataType: "json", data:({ currRow : centerPost[0], offset : ((-1 ...

Noob ASP.NET MVC Question

This is a very basic question. I feel kind of silly asking about it but I'm kind of stuck and hopefully some here can save me some time. So I open VS2008 go to file new ASP.NET MVC Web Application and click ok. I choose to create the test project. I hit F5 to debug my new MVC project. Then I choose to modify the Web.Config file to e...

PartialView is not rendering

In my View I have: <% foreach (Personas p in Model.Personas) { if (p.DisType == DisType.TextArea) { %> <% Html.RenderPartial("~/Views/Shared/Controls/Custom/xxx/Textbox.ascx", p); %> <% } } %> First I'm not sure that I have the <% %> right. Second, in my Partial View Textbox.ascx, I strongly typed it also to ...

Serialize Entity Framework Object using Json.Net

Hi, How do I serialize entity framework object into JavaScript Object (JSON)? I tried using JSON.NET but I am getting the following exception when I try to serialize it. Exception: Newtonsoft.Json.JsonSerializationException, Message="Self referencing loop" Hitesh ...

ASP.NET MVC without ASP.NET?

Hello SO Gurus, As far as I know, ASP.NET MVC leverages a lot of the features of ASP.NET Web Forms, one of these services is how to get the Html response from the template .aspx file (the view). Can asp.net mvc leverages any other platform to generate html over template files (something like PHP for example)? EDIT: There is NO use case ...

Retrieving data from Html.DropDownList() in controller (ASP MVC) | string returned?

I have the following problem: I have a form in site/banen (currently local running webserver) which is using a SQL database. The link is made using ADO.net and is instantiated in the controller in the following way: DBModelEntities _entities; _entities = new DBModelEntities(); // this part is in the constructor of the controller. Ne...

Does ASP.NET MVC Has Anything Equivalent To WPF's DataTemplate Feature?

In my ASP.NET MVC project, I have a polymorphic collection that I wish to render - say, an IEnumerable<ISomething> where the individual items may be a mix of different implementations of ISomething. I'd like that list rendered, where each concrete type renders according to its own template (perhaps a strongly typed ViewUserControl). In...

Access User.Identity.Name in HTMLHelper class

I am writing an HTMLHelper but I need to access User.Identity.Name, how do I do that? ...

how can i make asp.net mvc show a nice 500 error message?

how can i make asp.net mvc show a nice 500 error message? currently it is tells me that it could not find some view. ...

LINQ IQueryable Help

I have a Menu class that has a IQueryable property called WebPages. In the following statement I am returning Menu items based on a match but I need to include the Webpages property. Here is what I have at the moment. var allCategories = Menu.All().Where(x => x.CategoryID == 4 && x.Visible) I need to extend it to check a property in t...

Is it possible to get the type of a .Net object using javascript?

I wrote a web application using ASP .Net MVC. One of the application's function is to return a list of objects, using json, to the webpage. However these objects are of different types. How can I determine the types of these objects using javascript? ...

What's the correct response to unauthorized HTTP request?

I am writing web application I am not sure what is the correct response to unauthorized request. For user it is convenient when server response with 302 and redirects him to login page. However somewhere deep inside I feel that 401 is more correct. I am also little afraid if the 302 cannot be misinterpreted by search engines. So how do...

ASP.NET MVC ValidateInput(false) stops working with xVal and [RegularExpression] DataAnnotation

I would like to intercept the "<" character in the form field by a regex validator. I will describe the problem in 3 steps: Step 1: When I try to submit a form with a field containing the "<" character, I get the "Potentially dangerous request..." - as expected in ASP.NET. Step 2: To avoid ASP.NET's RequestValidation, I decorate my Upd...