asp.net-mvc

How do I restrict access to certain pages in ASP.NET MVC?

Hi folks, I wish to lock out access to a user's EDIT page (eg. /user/pure.krome/edit) if a) Identity.IsAuthenticated = false or they are authenticated but b) Idenitity.Name != user name of the user page they are trying to edit c) Identity.UserType() != UserType.Administrator // This is like a Role, without using RoleProviders. I'm ...

Page.User.Identity.IsAuthenticated return always false in safari

I am using DotNetOpenId and Asp.NET MVC. I have the following problem: When using IE not problem I can login and when I check the Page.User.Identity.IsAuthenticated I get true. If I test this in Safari for Windows the Page.User.Identity.IsAuthenticated is false. If I use Safari in Mac I can Login without a problem. Any Idea? What Other...

ASP.NET MVC: Masterpage: How to set css class on active menu item

Hello, I have the following menu in my masterpage: <ul id="menu" class="lavaLampBottomStyle"> <li> <%= Html.ActionLink("Employees", "Index", "Employees")%></li> <li> <%= Html.ActionLink("Customer", "Details", "Account")%></li> </ul> I need a way to set the css class of the current active li to "current". My ...

Delay when switching Controllers in ASP.NET MVC

Has anyone else found a noticeable delay when requesting a view that is under another controller? For example, all actions under the same controller seem to respond quickly, but when I follow a link that leads to another controller there is a lag - almost like it's compiling on the fly? ...

Extending Asp.Net MVC routing mechanism

I've found a limitation in the routing mechanism for ASP.Net mvc and I'm trying to find a workaround. I posted a related question here about the issue I was having. The gist of the problem is that routes that end with a . (period) are never handled by the default routing mechanism. A "Resource Cannot Be Found" error is always thrown. ...

Securing controllers in ASP.NET MVC to the correct user

I am building an application in ASP.Net MVC to log tasks. A user can delete only their own tasks. Is there a standard way to prevent a different logged in user, from simply typing in the delete controller url, with an [id] parameter of a task that belongs to another user, thus deleting another users task? Example: User A has a task wi...

.NET MVC and securely passing data between pages

a little background info first. I have been using Web Forms for most of my career and have recently become interested in .NET MVC. I realize that it is intended to be stateless, however, i dont understand how it is completely feasible. In a forms application, the user authenticates and I return a user ID and some roles which are then pla...

ASP MVC - confirm page when adding object to database

I'm making a simple CRUD app with ASP MVC and I want to have a confirm page when creating a new object and inserting it into the database. The problem is that I'm having trouble passing the object between actions. I tried to save it in the session after it's created and then retrieving it when the user confirms, but I'm getting an Inva...

Ways to bind a parameter to a different name in ASP.NET MVC?

I keep running into scenarios where I would like to provide a slightly more intuitive or "well-formed" parameter name for action methods, but with the default behavior, this is turning out to be quite painful. For example, suppose that I have an action parameter like GetWidget(int id). If I want it to be GetWidget(int widgetId), I have...

Restrict number of user account sign-ups in a period ???

I have a web app that requires a user to have an account. This user can then vote 'once' on a specific item. However, some users are signing up for lots of accounts to 'game' the system. Does anyone have any ideas how you can restrict this type of thing? Could I restrict number of signups per day per IP address? (what are problems with...

How do I export an ActiveReport to XLS in an ASP.Net MVC app?

I am unsure how to go about exporting my ActiveReports report document to XLS in my asp.net mvc app. My concept so far is to have a dropdown of export types and a submit button that submits that value to my controller. When I'm on the controller, I regenerate the report and pass it to my Export method. I'm not sure what to have this...

ASP.NET MVC ViewResult question

Is it legit to have your ASP.NET MVC ViewResult class implement IDisposable? My custom view result has a stream member that I want to guarantee is closed once it has been streamed back to the client. Does ASP.NET MVC honor IDiposable on ViewResult implementations? thanks! ...

Does a View Exist in Asp.Net MVC?

Does anybody know how if it's possible to determine if a specific view name exists from within a controller before rendering the view? I have a requirement to dynamically determine the name of the view to render. If a view exists with that name then I need to render that view. If there is no view by the custom name then I need to rende...

Are there nested master pages in ASP.NET MVC?

I wanted to know if the MVC framework can leverage the Nested Master Page? If so does anyone have some info on how to achive this? ...

Is ASP.Net (MVC) redirecting to the log in form when I generate a HttpUnauthorizedResult?

I'm actually using ASP.Net MVC, but I think this applicable to ASP.Net as well. Investigating how authorization works I've reached the conclusion that ASP.Net MVC generates an HttpUnauthorizedResult when the user is not authorized and should be. And then ASP.Net reads from my Web.config: <authentication mode="Forms"> <forms loginUrl...

Why Model View Controller and not Adapter View Controller? The "M" or Model lacks clarity...

The more I work with and read about ASP.NET MVC, it seems as though the "M" or Model is a topic that seems to cause a significant amount of confusion. Should the MVC framework really be renamed to Adapter View Controller? Where the Adapter is responsible for delivering data models to the view? ...

how to detect a click of a grid inside an iframe?

I have to put a grid inside a iframe. I select a row then the detail is loaded in the main page hosting that frame. How to do? An image is better than 1000 words. I want to reproduce a master-detail view like wufoo. The "black" grid is inside of the iframe. So the grid is always on top. Selecting a row, the detail page will be loaded on...

ASP.NET MVC Create on a Master-Detail Relationship

I am displaying an list of Items for a given Order. When a user clicks Add Item I redirect to the Item / Create page. This page collects that necessary input but also needs to know the order id that the item belongs to. What is the appropriate way to pass the OrderID to the Item / Create so that it survives the form post when the newly c...

ASP.Net MVC Stongly Typed Views

I created a stongly typed view in an ASP.Net MVC project I'm working on, the view is just an index page that lists the contents of a SQL table in a grid. I now want to add the functionality to filter this list. I've tried to do this by creating a form in the view with a drop down list containing the values you can filter by. The idea be...

ASP.NET MVC Action Gives 404 on Certain Params?

I'm getting a strange error in my MVC site. I have an action in my controller which responds to the default route of {controller}/{action}/{id} - in my case, /Project/Client/{id}. Depending on the id I pass to it, I get an error. With Elmah off, it's a straight-up ASP.NET 404 error. Turning Elmah on gives me the following: System.Web.H...