asp.net-mvc

Detecting IsAjaxRequest() with ASP.NET MVC and JQuery Form Plugin / File Upload

I'm using the JQuery Form plugin to do a file upload on an ASP.NET MVC application. I've learned that since an iframe is used for file uploads (rather than XMLHttpRequest, which isn't possible), the server-side check for IsAjaxRequest fails. I've seen a few posts related to this question but haven't come across any good solutions to wo...

Is there a way to make HTML.ActionLink Invisible by default?

I am trying to hide HTML.ActionLink by default when page first renders and then control it's visiblity based on the page the the user is on. Any suggestions? Thanks! ...

ASP.NET MVC POST Parameters in the url

url : /jobs/UpdateJobResults/GUIDHERE When I do a post to the below function the guid id is always blank, can I use the above format to POST the GUID in the url (as the form body has the results dictionary) ? [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateJobResults(Guid Id, Dictionary<string, object> results) { } ...

Debugging an ASP.NET MVC site and ASP.NET MVC Source Code

I have been given an app written by someone else and the error I get when I try to just launch the thing and the first look at it is: "There is no source code available for the current location." I could care less about the source code to ASP.NET MVC. How do I tell my project to show me the location where it is breaking in "my" co...

Comparing ASP.NET MVC and Grails for a new project.

Greetings, everyone. I consider myself to be an intermediate developer, but, to be candid, probably closer to novice than expert. In any case, I have more experience with C# and the .NET platform, but my current job has me working almost exclusively with Java. This in itself is sort of a problem, but I'm dealing with it fine and I'm not...

Force redirect to specific Action (ASP MVC)

Hi everybody! In my ongoing web project i encountered a problem regarding redirection. The scenario is this: a) user logs on. b) the count of records in a specific table determines if the user will be redirected to a specific controller/action c) user arrives in that particular controller/action and does something here d) (after ha...

best way to handle and display Status / Error messages in MVC?

What patterns are people using to display status messages and error messages to users in Asp.Net MVC? I currently use ModelState.AddModelError for problems with adding / editing / updating objects but what about after that? Say a status message's to let them know their action ran correctly? Was thinking about using TempData since alo...

C# MVC NerdDinner authorization helper method problem

I'm currently going through the ASP.NET MVC NerdDinner tutorial and am having a problem with a particular helper method related to user authorization. The idea is that only users who "own" a particular dinner should be able to edit or delete it (based on the Dinner object's HostedBy property). I have the following method in my Dinner ob...

Simulating a form POST to ASP.NET MVC with javascript

I've had problems trying to send JSON to ASP.NET MVC Controllers. I don't want to accept one string parameter on each controller method and deserialize manually. I have found that constructing a collection of post variables works reliably, but I don't have a generalized function to do so. I can write one myself if no one has done it a...

Role/Permission based forms authorizing/authentication ?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User.IsInRole(role from database) But is there any way to do the same thing with permissions on a role like : if (User.IsInRole(role from datab...

ASP.NET MVC 2 on mono

Is it possible to run the new ASP.NET MVC 2 Preview 2 on mono? ...

Visual Studio 2008 Performance Profiler Problems with ASP.NET

I've been trying, and failing, to get VS.NET 2008 to profile an ASP.NET MVC application. When I try and start a profiling session I get a generic server 500 error from VS.NET: The web site could not be configured correctly; getting ASP.NET process information failed. Requesting 'http://localhost:4750/foo/VSEnterpriseHelper.axd' returned...

Can WebForms and MVC live in a single project?

I'd rather be doing MVC as the regular WebForms development eats my soul. However, I've been given a fairly sizable WebForms project to add a bunch of features to. Is there anyway for WebForms and ASP.NET MVC to coexist in single project or even jointly handle the website? I know I am asking for a hack. ...

[RequireHttps] fails in MVC Preview 2 when applying to AccountController.LogOn

When trying to apply [RequireHttps] to AccountController.Logon in ASP.NET MVC 2 Preview 2 I get the following error : ASP.NET detected invalid characters in the URL. This is because ASP.NET has rewritten my request from http://example.com/admin to https://example.com/account/logon%3FReturnUrl=/admin It is ASP.NET itself that ha...

Paging in asp.net mvc like blogger

I like to implement a paging in my asp.net mvc(C#) application like the one in blogger(blogspot.com). The Paging should look like: `New Posts Home Older Posts` The Page should contain the number of items configurable. Any ideas on this? ...

ActionResult need to send a message to view

I'm storing the xls file in sql server. And shown the details in Grid. When multiple user try to access the file at a moment, If one user deletes the file and another user try to read the same file it throws error. And now i'm checking whether the file is their or not, how can i show a message to user that file is deleted. We suppose ...

Keeping State in Non-model Controls - MVC

Ok, I'm very new to MVC so bear with me if I'm asking a ludicrously straightforward question. I'm trying to develop a project in MVC where certain controls on the view will keep state but are not actually part of the model. I want to display Asp.net Charts and xslt grids on a page based on the content of various dropdowns. The data for t...

C# DataSet - Retrieving Unique Value based on column

Hello there, I'm having some issues trying to retrieve unique values from a DataSet in csharp, is that possible? Actually I'm doing something like this that gets a dataset from a webservice: webService.getInstructions(Username, Password, AppKey).Tables[0].Select(null, "account name asc"); So in this case I get a alphabetical list f...

Why mock HttpContext if it can be constructed?

Hi, I have always been faking/mocking/stubbing HttpContext somehow in ASP.NET (much easier in ASP.NET MVC/MonoRail). But I can see that HttpContext itself can be constructed easily, literally with couple of lines of code. var tw = new StringWriter(); var workerReq = new SimpleWorkerRequest("/webapp", @"c:\here\there\wwwroot", "pag...

MVC - FileContentResult Different depending on Dropdownlist selection

In my MVC project I have a chart being generated on my view as so <img alt="Report Chart" src="/Home/GetChart" /></div> Which calls a controller that returns FileContentResult Function GetChart() As FileContentResult Return File(MyChart(), "image/png") End Function Where mychart is a private sub that returns a byte array being ...