asp.net-mvc

ASP .NET MVC: How can I change the role of an user?

In my app I have an Administrator role, and these kind of users can change the role of a user(client, manager...). I am using the built in Membership provider. Here is what I tried to do... [AcceptVerbs(HttpVerbs.Post)] public ActionResult EditRole(string usernameID, FormCollection formValues) { var db = new App...

assigning ViewData to nested masterpages

Is there a good way to assign ViewData to nested master pages? For example, in my top level masterpage I might have info on the logged in user. I also have a nested masterpage that is displayed when the user is on any departmental page. I want that data available ONLY on departmental pages. So this is how it looks: Top Level Master Pag...

AJAX timeout issue in MVC

I have an ASP.Net MVC application. I am using an AJAX request on a page which requires user authentication to fire an action on another controller, which returns a view to update a table on the page. The action that the AJAX request makes also requires authentication. The issue comes up when the user lets their session timeout and the...

Security considerations for intranet developer making public facing website?

I have alot of experience writing internal Intranet applications, but very little when it comes to writing public facing web applications where it is likely that a certain percentage of people will try and be malicious. The app is written with MVC.net, JQuery and Subsonic. What steps can I take to project my application, to make it rea...

ASP.NET MVC Error Logging in Both Global.asax and Error.aspx

I'm creating an ASP.NET MVC application. I need to handle exceptions in two places. Global.asax.vb file: Public Class MvcApplication Inherits System.Web.HttpApplication ... Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) LogException(HttpContext.Current.Server.GetLastError(), Request) End Su...

ASP.NET MVC solution organization

Hello, I'm looking to create a fairly large-scale ASP.NET MVC project and I want to break it out so that it's not all in one project and one assembly. I looked at how Oxite does their organization (http://oxite.codeplex.com/Wiki/View.aspx?title=architecture) but I was wondering how other people do it too. Any suggestions? Currently, I'...

In search of a grid for ASP.NET MVC

I'm searching for a robust lightweight grid for ASP.NET MVC. I'd rather not write a grid, if someone else has done it,but I have yet to find a decent grid. It should be 508 compliant and for the most part, 508 compliance eliminates all the JavaScript grids. It has to be easy to use. Not too expensive ( a couple hundred dollars ) I'v...

JQuery - stop anchor tag from clicking through

I have the following code: //------------------------------------------------------// // When the document is ready, start firing our AJAX // //------------------------------------------------------// $(document).ready(function() { $("#navIndex a").click(function() { this.blur(); return false; }); $("#navP...

Showing a list of objects in asp.net mvc

I am new to MVC. I am developing an web application in asp.net MVC. I have a form through which users can get registered, after registration user redirected to ProfileView.aspx page. till here everything is fine. Now I want to show the articles headings posted by that user right under his profile. Right now I m using following code: pu...

Why do I am getting "Platform Not Supported Exception" while adding new Response Header?

Why do I am getting "Platform Not Supported Exception" while adding new Response Header? I am debugging website using Visual Studio webserver. code: Response.Headers["X-XRDS-Location"] = url Exception Message: "This operation requires IIS integrated pipeline mode." Any help would be appreciated... ...

Integer validation in asp.net mvc

I am using server side validation like public IEnumerable<RuleViolation> GetRuleViolations() { if (String.IsNullOrEmpty(Name)) yield return new RuleViolation("Name is Required", "Name"); if (Price == 0) yield return new RuleViolation("Price is Required", "Price"); yield break; } ...

A potentially dangerous Request.Form with ASP MVC

I have recently upgraded a project of mine from one of the beta builds of MVC to the full version. I am getting the yellow screen of death on one of my inputs "A potentially dangerous Request.Form yada yada". So I tried edting the pages validateRequest attribute, that didnt work. Then I tried adding [ValidateInput(false)] To the o...

Where can I find information on Authentication and Authorization in the context of Domain Driven Design ?

I'm trying to do things the DDD (domain driven design) way. And boy do I struggle. In all books I read, Authentication is of no concern and not mentioned! I've written my own Authentication and Membership Service which are responsible for registering and logging in users, creating salted passwords etc. I do not use .NET's Membership Pro...

How to add a prefix to all actions with ASP.Net MVC URL Routing?

I'm trying to write a MapRoute call that will make any route that is prefixed with "json/" prepend "json" to the action's name. For instance, a route something like this: "json/{controller}/{action}" with "json/Foo/Bar", it should result in: controller = "Foo" action = "jsonBar" Any ideas? ...

MVC - Getting membership provider to work

Hi, I have MVC 1.0 app developing with VS2008. Brave! I have developer edition of SQL 2005 installed. I ran the aspnet_regsql.exe to add membership schema to my DB. When i try to register a user I get this error: The user instance login flag is not supported on this version of SQL Server. The connection will be closed. I have modif...

Website security pitfalls and what can I do in ASP.NET MVC to avoid/mitigate them?

I've just started working on implementing my first public-facing website. Since I'm new to this, I think if a list of common pitfalls, what they are, and how to avoid them is warranted. I'm looking for things like: SQL injection (I know this one, but if anyone knows of tools to analyse a website for injection vulnerabilities, that'd b...

Implementing Custom Profile Provider in ASP.NET MVC

Hi, I tried a lot on implementing a custom profile provider in ASP.NET MVC. I've read lots and lots of tutorials, but I can't find where is my problem. It's pretty similar to that question: http://stackoverflow.com/questions/79129/implementing-profile-provider-in-asp-net-mvc. But I'd like to create my own Profile Provider, so I wrote th...

ASP.Net MVC ModelState / Html.TextBox postback issue

I have an issue cropping up in a form I'm trying to post. In the scenario where the form doesn't validate, I'm taking the standard route of calling ModelState.AddModelError() then returning a View result. The thing is, the HTML.* helpers are supposed to pick up the posted value when rendering and I'm noticing that my text fields ONLY do...

capturing output in ASP.NET MVC

I have a need to capture all the rendered output/html of a view so that I can persist the result. How can I do this within ASP.NET MVC? ...

Accessing Application Settings in ASP.NET MVC view

I'm trying to build a global menu into my ASP.NET MVC site.master, and I was wondering how I could go about accessing the Application Settings property from the site.master markup? Previously I probably would have instantiated a config object from my site.master's code-behind and then set a public property. But now I'm scratching my he...