Did something change in MVC 3? I have tried all the examples on the Internet for setting up Unity as my IoC Container, but I keep getting an error saying that Unity cannot resolve my UserController. Here is my constructor on my UserController:
public UserController(IUserService userService)
{
_userService = userService;
}
I have...
I have a very odd issue, where I've created a custom MSBuild task that would move all files I need for my MVC project to a specific location so that we can publish it. This works fine when I trigger the script localy on my machine but as soon as I check this changes in and Teamcity runs the script, it copies everything except from the Bi...
How to set path custom path for cookies
...
Im using the Facebook SDK (http://facebooktoolkit.codeplex.com) to include Facebook-Connect into my Asp.net MVC Project. After someone logs into my Webapplication via Facebook Connect (I implemented that Facebook-Login-Button successfully) I want to fetch some data from the User. Therefore I created an ActionFilter that just checks if th...
I want to use the standard AuthorizeAttribute (i.e. not inherit it) but with a custom redirect. Is that possible? where should I check for 401 and redirect?
I've tried to add
<customErrors mode="On" >
<error statusCode="401" redirect="/Errors/NotAuthorized/" />
</customErrors>
but it didn't work.
...
I have an Html.ActionLink on my page and I am using the following CSS on it to give it an image and try and remove the underlining.....
a.searchButton
{
background-image: url(/content/images/DropAcross.png);
background-repeat: no-repeat;
height: 16px;
width: 16px;
display: block;
text-decoration: none;
clear:...
partial void OnValidate(ChangeAction action) {
if (!IsValid)
throw new ApplicationException("Rule violations prevent saving");
}
i am following this tutorial:
http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf
and am not able to compile the above code. it is in my NerdDinner.Models.Dinner
am i placing it in the wrong l...
Hi,
Bit of a vague question. Apologies.
I have a prototype CMS I've been working on for fun. It's completely written in ASP.NET MVC.
It works on the principle of "widgets". Little blocks of functionality that can be dragged and dropped on the page, you get the idea.
I have added a few simple blogging widgets which work well, one of...
I am working with a new project which is really complex and is written with MVC 1.0 and heavy jQuery implemenation. Since there is not a lot of documentation it is almost impossible to trace the flow of commands in the entire application. So I am trying to debug it and learn the implementation, but with jquery implementaion, it gets hard...
I am using ASP.NET MVC to develop a web application and would like to display different web pages based on the geographic location of the incoming HTTP requests. Any idea how I can achieve this?
...
I am currently trying to implement some custom security in an ASP.NET MVC2 web application.
I am trying to do something really simple as my code below shows but for some reason if I use the [Authorize(Roles="Admins")] attribute on one of my controller actions, check the Context.User.IsInRole("Admins") or Page.User.IsInRole("Admins") it ...
Right now I'm having an issue with a Singleton that I just wrote for use in ASP.NET MVC -- My Singleton looks like this:
public sealed class RequestGenerator : IRequestGenerator
{
// Singleton pattern
private RequestGenerator()
{
requestList = new Stack<Request>();
appSettings = new WebAppSettings();
}
...
Hi,
I have a view in ASP.NET MVC. It takes the model object and iterates over a list of strings and displays them in a table row, like so:
Details
<table>
<tbody>
<tr>
<th>Values in the database</th>
</tr>
<% foreach (string value in Model.lstDistinctValues)
{%>
<tr>
<%=value%>
<%} %>
</tr>
</tbody>
...
Greeting Everyone,
I'm having a little trouble with a partial view I'm using as an edit form. Aside from the hidden elements in the form, the model is null when passed to my EditContact post controller.
I should add, I realize there's a more seamless way to do what I'm doing using AJAX, but I think if I can solve the clunky way first ...
I am using xVal for my validation purposes.
I have date that uses 3 dropdowns - month, day, year.
How would I validate a date like that using xVal? Even if maybe just on serverside? (and then write my own clientside validator?!)
Like how I should name these 3 dropdowns... etc... any working example?
...
I'm using the following code:
<form action="" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<input type="submit" />
</form>
And...
[HttpPost]
public ActionResult Index(HttpPostedFileBase file) {
if (file.ContentLength > 0) {
var fileName = P...
I'm pretty new to ASP.Net MVC. I've created a model that fills a List<> with multiple custom objects called "Result". Then, in my controller, I get this List and put it into the ViewData.
I am at a bit of a loss as to how to utilize this List in my view (aspx page). My first try was just to put ViewData["Results"] between the <% %>, ...
I need to start worrying about user input. I notice the htmlhelper class doesnt do a great job of this. Can anyone suggest a nice framework for input sanitization? I'm using asp.net mvc2.
...
I'm building a form that will allow my site's users to set a secret question and answer. I'm using NHibernate to persist my model to our database.
public class User {
public string Question { get; set; }
public string Answer { get; set; }
}
I want to encrypt the input from the user before storing it in the database. My first ...
Does (or will) a tool exist to convert WebForm view engine markup (aspx) to Razor view engine markup (cshtml)?
...