asp.net-mvc

asp.net mvc code not getting compiled on server

i have this code in one of my asp.net mvc views: <%Html.RenderFile(@"C:\Members\newsletters\welcome.html");%> I have created an extension on the Html class to read in a file. the code looks like this: public static class HtmlRenderer { public static void RenderFile(this HtmlHelper helper_, string path_) { var read...

External stylesheet content gets included on page somehow

I've run into a weird issue with a site running ASP.NET MVC on IIS7. Whenever I do a page refresh (F5), the external stylesheet content gets "injected" into the page itself, instead of the tag pointing to the css file. Example: <head><link type="text/css" rel="stylesheet" href="external.css" /></head> Renders as: <head><style type...

How to creat a readonly text using html helper in asp.net mvc?

I want to disable a textbox in the view. So I use following code: <%= Html.TextBox("ID", Model.ID, new { readonly="true" })%> or <%= Html.TextBox("ID", Model.ID, new { enable="false" })%> Both of them don't work. what's the solution? ...

Storing expensive objects to be reused in ASP.NET MVC?

Howdy, I'm trying to extend one of my WebApps using IronPython, unfortunately the code below runs pretty slowly: var engine = Python.CreateEngine(); SourceCodeKind st = SourceCodeKind.Statements; string source = "print 'Hello World'"; var script = engine.CreateScriptSourceFromString(source, st); ...

How to name a file for download on Firefox?

The following headers work on IE but not on FF <%@ Page Language="C#" ContentType="text/csv" Inherits="System.Web.Mvc.ViewPage"%> <% Response.AddHeader("Content-Disposition", "filename=report.csv;attachment"); %> In FF the suggested name in FF appears as "report" without the extension. ...

ASP.NET MVC customization - Inherit or alter Framework

If you wanted to alter the way that routes were processed can you do that in a MVC project OR do you have to alter the MVC Framework? For example lets say you have the standard code in RegisterRoutes of Global.asax.cs: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); ...

How to catch HttpAntiForgeryException in ASP.NET MVC

I'm using the AntiForgeryToken in my ASP.NET MVC forms. If I deactivate cookies in my browser and send the from, I'd get following error message: A required anti-forgery token was not supplied or was invalid. How can I prevent this message from showing? I would prefer redirecting the user to another page. I've activated customErrors a...

Jquery selector length restriction?

I am using ASP.Net MVC which has created an id for a textbox for an object which is deep within my object tree as follows: <input id="evt_SessionLinks[0]_Sessions[0]_TimeTables[0]_TimeWindows[0]_Finish" name="evt.SessionLinks[0].Sessions[0].TimeTables[0].TimeWindows[0].Finish" type="text" value="" class="clockPick"/> I am trying to s...

Best rendering engines for web applications

I am load testing web applications to compare performance of different rendering engines with the goal to rate NDjango view engine (an implementation of the Django Template Language on the .NET platform NDjango ). I compare Django with ASP and ASP.MVC rendering technology. Can you recommend me some other rendering engines that really ...

Is there a way to get upload progress using the HttpPostedFile class?

I want to use the HttpPostedFile Class to upload one or more large files to an ASP.NET MVC controller from a web page. Using this class, uploaded files larger than 256 KB are buffered to disk, rather than held in server memory. My understanding is that it can be done like this: if (context.Request.Files.Count > 0) { string tempFi...

Customer Feedback Alternative to UserVoice?

We are currently hosting an ASP.NET MVC application and we wish to incorporate a turn-key customer feedback system. UserVoice will absolutely meet our needs, but we'd like to consider alternatives before moving forward. GetSatification appears to provide a similiar model. Are there any other service which we should consider as well? ...

dropdown value null when using, viewmodel & modelbinder in asp.net mvc

I am using asp.net's modelbinder functionality to bind form values to my entity when posting from a view. The html renders correctly in the initial view with correct option and value items. When completing the form and posting, all values are populated correctly into the entity except the value from the dropdown list. not sure what I ...

Dynamic Object Properties in a MVC Helper on a Entity Framework object

I am new to vb9 and the .NET MVC. I want to build a MVC helper function for which I pass a Entity Framework object and have it build a select. Generally speaking I tried something like this: Public Function RenderSelect(ByVal helper As HtmlHelper, ByVal sSelectName As String, ByVal aItmes As Array, Optional ByVal sTitleKeyName As Strin...

jQuery button click refresh of jqGrid only firing once

I have the following jQuery code which I'm using to populate a jqGrid. It works perfectly posting to my ASP.NET MVC page on the first click of the button. My problem is, any other clicks past the first it seems to run through the jquery code when clicking the button but it never makes it to the POST page. Any ideas why? <script type="te...

ASP.NET deployment - How to share BIN across multiple WebApp Projects?

What is the best practice for sharing the assemblies of a bin folder across multiple ASP.net websites in IIS 7? I've got several sites, each with slightly different HTML front ends, but all with the same middle tier logic and DB. I don't want to redploy the same dlls to each of the many site's bin folders everytime I make a change. Th...

Removing null/empty keys from a query string in asp.net MVC

Is there a way I can remove null or empty keys from a query string in asp.net MVC? For example I have a page where I filter data on a results table, if I search for John the query string would be redisplayed as: candidates?FirstName=John&LastName=&Credit=false&Previous=false&Education=&Progress= and not candidates?FirstName=John I ...

Exclude HttpModule from running for static content on IIS7

I have a problem with my Authentication HttpModule. The problem is that it obviously runs for every single request I get on my web server (IIS7). Because it also uses Session variable, it fails to work properly on CSS, JS files and similar. I tried to use: <add name="AuthModuleName" type="..." preCondition="managedHandler" /> but to ...

problem with browser cache

Hi everyone. I'm having a problem with ASP.NET MVC 1.0. The first time I access a View "Products", its ActionResult method is called without a problem (I used a breakpoint to see it). But, if I access a View "ProductsOrders", for example, and try to go back to "Products" by pressing browser go back button, the "Products" ActionResult ...

Troubleshooting the built-in Visual Studio 2008 WebDev.WebServer.EXE

How do I begin to troubleshoot Visual Studio 2008's WebDev.WebServer.EXE? I'm trying to run the default ASP.NET MVC project. And I keep getting this message from Firefox: Unable to connect Firefox can't establish a connection to the server at 127.0.0.1:52589. * The site could be temporarily unavailable or too busy. Try again in a...

How do I create a two-column snaking layout in ASP.NET MVC?

I have about a hundred short-text data items (this number can vary substantially) that I would like to put in a page and have the browser manage that into three columns within a surrounding div, arranged with the items going down and then across, like this: A F L B G M C H N D I O E K ... Is there a way t...