asp.net-mvc

HttpPostedFile in File Upload process is NULL if I use AJAX

I am using file upload fucntionality in my asp.net MVC project. It worked great until I started using some AJAX functionality on my page. The HttpPostedFile is always NULL on Ajax page. How can solve this issue along with calling ajax on my page? ...

Getting exception when trying to access FormValues() element

The exception: "Input string was not in a correct format." Appears when I try to access a field on my page like this: .TransmissionId = IIf(FormValues("TransmissionId").Length > 0, Integer.Parse(FormValues("TransmissionId")), 0) However it works for another field which is the same exact type of field, accessed like this: .StateId ...

MVC Routing Help Required

I'm trying to map the following routes in MVC2. [absoluteUrl] [absoluteUrl]/[dynamicBlogName] These two routes should map to the same controller/actionresult. e.g PostController/Index I also need to map these routes. [absoluteUrl]/post/[dynamicPostName] [absoluteUrl]/[dynamicBlogName]/post/[dynamicPostName] These two routes sh...

Why is ASP.NET MVC asking me to re-authenticate for .PNG files but not .gifs or .jpegs?

What am I missing here??? For some reason, anytime I reference a .png from my application.css file I get prompted for credentials. BUT, I can reference .gifs, .jpegs, etc... from my images directory no problem. Routes are set up right now like this ... public static void RegisterRoutesTo(RouteCollection routes) { routes.Igno...

How can I call ASP.Net MVC based on urls checked against a lookup table?

I've got a unique requirement in my unique ASP.Net MVC project. Basically we are migrating an older Linux based website to MVC and we want to preserve the URLs which were on the last website. It is not practical to create a new controller for the subdirectory (ex. 'www.mywebsite.com/pickes/cherry-pickle-recipe.html') of the website. So...

Issue in jquery ajax on download file link

In my page i have download links to files like Documents,Audio and Video and on click of that download link i want to update hits counter in database for that i use the strategy of jquery ajax request that will update hits counter but the issue is when i click on hyperlink it call the jquery function but doesnt call my controller action ...

Package Manager Console issues

I installed Asp.net MVC 3 beta which also installs NuPack, but when I open a project in Visual Studio 2010 Express, the Package Manager Console gives me this error message: System.TypeLoadException: Could not load type 'System.Management.Automation.Runspaces.InitialSessionState' from assembly 'System.Management.Automation, Version=1.0....

ASP.NET MVC, Ninject, single instance per request for multiple constructors

Im trying to implement an unit of work pattern by passing an unit of work instance into my repositories. Relevant code from Global.asax. public class SiteModule : NinjectModule { public override void Load() { Bind<IUnitOfWork>().To<SqlUnitOfWork>() .InRequestScope() ...

Optimistic concurrency model in Entity Framework and MVC

I have the following update code in the ASP.NET MVC controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Person(int id, FormCollection form) { var ctx = new DB_Entities(); // ObjectContext var person = ctx.Persons.Where(s => s.Id == id).FirstOrDefault(); TryUpdateModel(person, form.ToValueProvider()); ctx.SaveChanges(...

How can I render this data, into a Grid, in an ASP.NET MVC view?

Hi folks, I want to copy StackOverflow's TAG's page, where they have a list of Tags (or whatever) and display them into a few columns, with the first column being the first 10 records, the second column being record 11->20 .. etc. and of course I have my data already paged. I'm not sure what this type of view is called? is this a grid...

ASP.NET MVC inject per request

I need to inject EF context per request. Is there any way to implement it? ...

Display uploaded document from database

Hi there, I have a MVC 2 web application. The website captures grant applications for loans. With each application I can upload documents. The way that we upload documents to the database is as follows: private IEnumerable<byte> GetStreamByteArrayData(Stream stream) { byte[] buffer = new byte[8192]; int bytesRead = 0; while...

How do I implement CRUD access with actions using the same view?

How do I implement CRUD access with actions using the same view? class UserController : Controller { [ActionName("User")] [HttpGet] public ActionResult GetUser() {/* ... */} [ActionName("User")] [HttpPost] public ActionResult PostUser() {/* ... */} } I would like both actions to use the same view. Is there an attr...

Define cookies in base call controller

I have two controllers: parent controller inherits from Controller. public class ApplicationController : Controller { public ApplicationController() { } } child controller inherits form above mentioned class. public class LayoutController : ApplicationController { public ActionResult Index() { } } and have...

ASP.NET MVC Interview Questions

Hello, I have to interview a guy for an ASP.NET MVC position. Its a short term contract so I need someone who knows it pretty well. Also there is a lot of JQuery involved. I was thinking of starting with general questions like: What is MVC in general? Why use ASP MVC Framework? Comparison with Webforms. .. etc. But what other ques...

Is this a good reason to use a service bus, alternatives please

I'm in the planning phase of our new site - it's an extension of some mobile apps we've built. We want to provide our users with a central point for communication and also provide features for users who don't want to/can't use the mobile apps. One of the features we're looking at adding is a reputation system similar in nature to the SO ...

ASP.NET-MVC: Do Database Default Values Break The Spirit of Unit Testing?

Related Question My Question: In the key of ASP.NET-MVC - Do Database Default Values Break The Spirit of Unit Testing? ...

Application plugin system

I’m writing an ASP.NET MVC 2 application where developers could extend it with plugins. I’ve started to consider how create a plugin system. (e.g. like Joomla’s) I have some doubts about how to do this. I have searched over the net and I found that there are two potential solutions. using interfaces or abstract classes to implement me...

How to automatically overload DELETE and PUT if they are not available by the client?

How can I detect at the startup of the application that a client doesn't support DELETE and PUT verbs and automatically overload the POST verb? On the server side, how can I redirect those overloaded POST verbs into the right actions? Say I have a DELETE request that is overriden, how do I call the appropriate function in the controller ...

What databases are people using in Cloud environments with ASP.NET / ASP.NET MVC?

I am looking at hosting a new site on a cloud service. It looks like cool technology, pricing is attractive, and I can scale in case my plans for global internet domination come to fruition. I have spent a good chunk of time figuring out what back-end to use thought. The site is in ASP.NET MVC, and I have hit a brick wall when it come...