asp.net-mvc

ASP.NET MVC application running II6 with wildcard mapping using only 3 threads

During the performance testing of our ASP.NET MVC application I discovered interesting bottle neck. The application is using only 3 managed threads. I checked maximum thread pool size. It's 200 and we are having 197 available threads. I checked connection limit of web site and it's unlimited. I tried to run stress test locally agains...

ASP.Net MVC Custom Authentication

I'm looking to create a custom authentication model for my MVC app but I'm not sure where to implement my custom IPrincipal and IIdentity classes. I don't want to do this in the Global.asax on every request as not all the pages in the site will need authentication. So my question is where? Should I be doing this in my custom action filte...

Am I going about this the wrong way?

This is my first MVC/Linq to SQL Application. I'm using the out of the box SQL Membership with ASP.NET to track users through my system. As most of you know, the UserId is a guid, great. However, to link other user-created tables in the system, I decided to go with username instead of userid. The reason I did this was because: Use...

Passing Multiple Json Objects as data using jQuery's $.ajax()

I am POSTing data to an MVC controller and I'm attempting to maintain state as well for optimistic concurrency. I'm currently posting back a JSON request, but would be open to workable alternatives? I am already posting a name/value collection with the following command: $.ajax({ url: g_appPath + "/Rounding.aspx/Round/" + $("#Offe...

How do I Remove a table column in MVC?

I want have two columns and based on a condition, include or remove a third. using all the if statements seems a bit redundant. Is there another way to do this? <table style="width: 60%;"> <tr> <th>Name</th> <th>Age</th> <th>Other</th> </tr> ...

ASP.NET error BC30456: 'Title' is not a member of 'ASP.views_controllername_viewname_aspx'.

My ASP.NET MVC application fails with this error: BC30456: 'Title' is not a member of 'ASP.views_controllername_viewname_aspx'. But, Title doesn't appear anywhere except the first line of my View. <%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of SomeThing)" %> ...

Problem with related entity on asp.net MVC create form using entity framework

Hi There I am building a very simple asp.net MVC file upload form. Currently I have a problem creating the new database object that stores info on said file. The code for the action method looks as follows: [Authorize(Roles = "Admin")] public ActionResult AddFile(Guid? id) { var org = organisationRepository.GetOrganisa...

asp.net MVC Routing Problem

Someone has asked me to look at their code to do a few little changes to the processing, but before I can get anywhere, I can't even run up the main page. It seems to be MVC, seems to have the right routes etc. It defaults to a ~/home from default.aspx and there seems to be a route in place, but I get a 404. I've tried changing the rout...

Why are my foreach loops in an ASP.NET MVC View so slow?

I use a foreach in my View to loop over my strongly-typed Model and display a table. With only 25 rows and 7 columns, it takes about 280 msec. This seems slow. Is there some performance trick I should know for using loops in Views? EDIT: My Controller takes data from an Azure Table and feeds it to a View using a ViewModel pattern. I...

Can the View render only first nth of a string

I'm rendering a drop down where the text rendered in the drop down is too long for comfort. How can I go about limit the number of characters that display in the dropdown without having to go back to the controller? <option value="<%=order.ID %>"><%=order.Item %></option> thx ...

Returning a column from a linked table in LINQ to SQL

My problem is that I am trying to return a simple query that contains an object Story. The Story object has a UserId in the table which links to aspnet_users' UserId column. I have created a partial class for Story that adds the UserName property since it does not exist in the table itself. The following query gets all stories; howeve...

Mocking FormsIdentity.Ticket.UserData with Moq

As part of a unit test I am trying to mock the return value of FormsIdentity.Ticket.UserData The following will NOT work but it should give an idea of what I am trying to do: var principal = Mock<IPrincipal>(); var formsIdentity = Mock<FormsIdentity>(); formsIdentity.Setup(a => a.Ticket.UserData).Returns("aaa | bbb | ccc"); principal.S...

Telerik MVC Extension conflicts with JqGrid?

I am trying to use Telerik MVC extension with jQGrid in a ASP.NET MVC application. But I found they cannot nicely play each other, meaning I cannot have them working together in one View. No sure why? I guess it is because the place for js files. JqGrid needs to put the js library in Head, but Telerik requires before end of Body tag, bas...

What Web Analytics Sites/Software Have a Good API Besides Google Analytics

I cannot use Google analytics because of their limitations on the API. They will not allow me to query more then 10,000 entries in one day. Since I have more then 10,000 pages Google Analytics will not work for me unless there is a way around that 10,000 limitation. I need to pull statistics on all my pages daily and it will be over 10,0...

ASP.NET MVC: how to include <span> in link from Html.ActionLink?

I need the text of a link wrapped with <span> as in: <a href="/foo.html"><span>Edit Group</span></a> Can I do that with Html.ActionLink? This doesn't work: <%=Html.ActionLink("<span>Edit Group</span>", "Edit", New With {.id = "bar"})%> It just HTML encodes the < and > as &lt; and &gt;. Is there a simple solution, or should I buil...

Using <%$ %> in ASP.NET MVC

In ASP.NET WebForms you can reference appSettings directly in your markup with this syntax: <%$ MySettingKey %> Unfortunately this does not work in ASP.NET MVC because, as MSDN points out, this syntax only works in server controls. I've run into a few situations where I would love to use this syntactic sugar in an ASP.NET MVC view (W...

Is this the correct usage of the ViewModel Pattern?

I'm using NerdDinner as a guide for my first MVC/LINQ to SQL project. It discusses the use of the ViewModel pattern when a View needs data from multiple sources - in their example: Dinners and Countries (serves as the drop down list). In my application, the problem is a bit different. It's not so much different data, rather data linke...

jqgrid pass value throught url for ASP.NET MVC Controller

I have a jqGrid script like that: jQuery(document).ready(function() { var startDate = $("#startDate").Val(); jQuery("#sandgrid").jqGrid({ url: "/Deposit/Search?startDate='" + startDate + "'", datatype: 'json', mtype: 'GET', height: 255, width: 700, colNames: ['Index', 'Name', 'Code'], colModel: [ {...

Where to place the code for best practice?

I have an asp.net mvc application and I have a page for presenting meteo information. It looks like: Temperature for today is 34-35 degrees For this 34-35 degrees , I have a method that assure that the text will be in format [Number][Dot][Number] called AssureCorrectDegressFormat(). Now I am asking where is it suited t...

How do I create a view from a generic list?

I have a generic list List<T> and I want to create a view that iterates the list and spits out the output. I'm coming up against a couple of issues: I don't know how to get my view.aspx to understand T I don't know how to get it to render the correct partial for T For instance, if I pass in a list of CustomObject1 then I want to ren...