Maybe I'm using the wrong terms, but I've been Googling for two days and just can't find anything on this: grouping roles/permissions. Or maybe I don't quite understand membership in the ASP.Net model.
Currently I have a homegrown authentication system in a PHP site, with users, permissions, and roles. Each role (such as "User" or "Te...
I trying to check if an exception has been raised by an action with the filterContext.Exception below:
public class Test : ActionFilterAttribute
[...]
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
if (filterContext.Exception != null)
{
...
I have a WCF service that lives side-by-side with an MVC2 web site. I'd like for my URL for the service to look like this:
http://localhost/projdir/Service
The MVC site is in its infancy so it still has all its boilerplate controllers etc.
The following code works at first glance in global.asax:
public static void RegisterRoutes(Ro...
I'm trying to make a post call to an action method in MVC 2. But it doesn't seem to work. I have set a break point right at the beginning of the action method, but the debugger never hits the breakpoint. What am I doing wrong? Here's the jQuery (for simplicity I have simplified it by removing parameters both from the call and the action ...
In ASP.NET MVC2,
How do I change routing/folder structure so I can have
Views\FOLDER\Account\ChangePass.aspx
Rather than:
Views\Account\ChangePass.aspx
I don't actually want to do it for the account, but I'd like to structure things like that, e.g.
SO I can have two different views like:
Views\Categories\
Views\Admin\Categori...
Lets say i have this entity
public class Address : Entity
{
public Address()
{
ModifiedDate = DateTime.Now;
}
[NotNull]
public virtual Province Province { get; set; }
[NotNullNotEmpty]
[Length(Max = 80)]
public virtual string Line1 { get; set; }
[Length(Max = 80)]
public virtual string ...
Hello,
In _Layout.cshtml file I have following entry:
@Html.Action("LoadPagesStructure", "Page")
Inside PageController class, LoadPagesStructure methos looks following:
[ChildActionOnly]
public ActionResult LoadPagesStructure()
{
ViewModel.Pages = new List<string>() {"page1", "page2", "page3"};
return View();
}
Fi...
Hi,
one thing that has been puzzling me since learning MVC2 is the following case scenario:
I have a view which contains two latest news lists, a login form and a signup form.
Every example I found on Views and View Models so far has a one-to-one example such as a simple login form etc. But how do I create a model that provides the pr...
I want to disable button when user first click it so it must not save multiple record if a user have a slow connection. Im using asp.net mvc2
...
Here's the error I get:
Description: An error occurred during
the compilation of a resource required
to service this request. Please review
the following specific error details
and modify your source code
appropriately.
Compiler Error Message: CS0411: The
type arguments for method
'System.Web.Mvc.Html.SelectExtensi...
I edit the Dinner (from the NerdDinner tutorial) and save it, but the Country isn't persisted. Here's my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace NerdDinner.Models
{
public class DinnerFormViewModel
{
private static string[] _countries = n...
It seems that to skip a member to come on a View you can set ScaffoldColumn attribute to false in your model
[ScaffoldColumn(false)]
public object Id { get; set; }
but here i see that Id is of object type. Is this the only way? I tried with
[ScaffoldColumn(false)]
public int Id { get; set; }
but it didn't work. How can i prevent...
I'm trying to use Controller.File to return a FilePathResult from a view in my ASP.NET MVC 2 project. I use it like this:
return File(pdfFilePath, "application/pdf", "foo.pdf");
However I keep getting this error in the yellow screen of death:
The process cannot access the file [the file path] because it is being used by another proce...
Hi, is there any possibility to create a maproute which would use always one method and it won't be necessary to put it in address?
I mean I've got controller with one method (Index) and it displays items depend on methods argument.
public ActionResult Index(string TabName)
{
var tab = (from t in BlogDB.Tabs
...
aspx site:
<script type="text/javascript">
function AjaxTest() {
var codeVal = "hello world";
if (codeVal) {
$.ajax({
type: "POST",
url: "CheckAge",
data: { code: codeVal },
contentType: "application/json; charset=utf-8",
dataType: "json",
async:...
I'm trying to position my picture a little bit lower so the center of the image aligns with the vertical center of the header tag.
Here is the both the HTML and the CSS. Thanks for the help!
#articlesummary
{
border: 2px solid red;
width: 750px;
}
#articlesummary h3
{
border: 2px solid red;
display:inline;
co...
Hello i have just started learning mvc2 and im having a problem with the default value for the parameter page(you can see the method below).
Its always 0 regardless of what i type in the URL. For example this
h.ttp://localhost:52634/Products/List/2
should show page 2 but when in debug mode the page parameter is 0, so im always gettin...
Hi All,
I have amaster page that calls render action:
<% Html.RenderAction("CategoryList", "Category", new { selectedCategoryId = Model.selectedCategoryId }); %>
and the action looks like:
[ChildActionOnly]
[OutputCache(Duration = 10, VaryByParam = "none")]
public ActionResult CategoryList(int? selectedCategoryId)
{
CategoryLi...
First, some background: I'm new to ASP.NET MVC 2 and NHibernate. I'm starting my first application and I want to use NHibernate, because I come from JSP + Struts 1 + Hibernate web applications.
No one seems to be talking about this, so I guess it must be pretty obvious. Still I scratch my head because I can't find a solution that accomp...
Ever since we upgraded to .Net 4.0 and VS2010 (from 3.5 and 2008) we can no longer get intellisense on LINQ to kick in when working in our views. Before the upgrade everything was working fine, but after the upgrade it's actually listed as an error when we try to use things like .Where() on a collection. Oddly it will compile fine and ru...