I'm having a hard time finding information on what I expect to be a pretty straightforward scenario. I'm trying to unit test an Action on my ASP.NET Mvc 2 Controller that utilizes a custom input model w/ DataAnnotions. My testing framework is xUnit, as mentioned in the title.
Here is my custom Input Model:
public class EnterPasswor...
Hi all,
I have two very similar specs for two very similar controller actions: VoteUp(int id) and VoteDown(int id). These methods allow a user to vote a post up or down; kinda like the vote up/down functionality for StackOverflow questions. The specs are:
VoteDown:
[Subject(typeof(SomeController))]
public class When_user_clicks_the_vo...
hi ,i am new to jqgrid ,
i'm placing the code what i did .my question is that when i click html button i need to refresh the grid value with new values?how i pass paramateres to controller?
thanks in advance
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<link rel="stylesheet" type="text/css" href="/s...
I'm starting to use ASP.NET MVC2 and I was using [AcceptVerbs(HttpVerbs.Get)], so I changed to [HttpGet] and now I get a blank page!
I know I've missed something what is it?
The working version looks like this:
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Details(int id)
{
...
}
When I change it to this it...
I have a folder called areas, in it I have 2 folders (Admin and Portal). How would I need to set up my Default route so when I start the site at the root site it routes it to Portal/Home/Index action?
...
Hi,
I am trying to read an XSLT file from disk in my ASP.Net MVC controller. What I am doing is the following:
string filepath = HttpContext.Request.PhysicalApplicationPath;
filepath += "/Content/Xsl/pubmed.xslt";
string xsl = System.IO.File.ReadAllText(filepath);
However, half way down this thread on forums.asp.net there is the foll...
Im creating a asp mvc application and im using a sitemap to create my menu.
Is it possible to change the output of the Html.menu() asp control?
normal output:
<ul>
<li><a href="#">Item 1</li>
<li><a href="#">Item 2</li>
</ul>
needed output:
<ul>
<li><a href="#"><span>Item 1</span></li>
<li><a href="#"><span>Item 2<...
I have an action in DiagnosticsController called ErrorEmail but I get the following error when attempting to trigger a HealthMonitoring email. Any suggestions would be great.
Here are my web.config settings:
<providers>
<add name="TemplatedEmailWebEventProvider" type="System.Web.Management.TemplatedMailWebEventProvider" template="Di...
Is there a way to mark a Controller Action to not reset the Forms Authentication ticket sliding expiration? I want to poll the server every x seconds for new info using ajax but that will effectively prevent the user session from ever expiring.
...
I have developed a plugin system that makes it easy to plug in new logic to an application. Now I need to provide the ability to easily add UI widgets.
There are already some good responses on how to create a portal system (like iGoogle) with ASP.NET MVC, and I'm fine about the overall concept.
My question is really about how we make s...
Hi!
I have a problem regarding MVC Anti forgery token.
When I do my authentication I have pseudo code like this:
var user = userRepository.GetByEmail(email);
System.Threading.Thread.CurrentPrincipal = HttpContext.Current.User = user;
by doing so I'm able to get the current user in my code like this:
var user = HttpContext.Current.Use...
Is is possible to have a partial view inherit more than one model? I have three models (Contacts, Clients, Vendors) that all have address information (Address). In the interest of being DRY I pulled the address info into it's own model, Addresses. I created a partial create / update view of addresses and what to render this in other othe...
This is a bit of a continuation of a previous question.
Now I'm trying to make a call to an AJAX enabled web service which I have defined within the ASP.NET MVC application (i.e. the MovieService.svc). But the service is never being called in my getMovies javascript function.
This same technique of calling the AJAX web service works o...
I am developing a personal blog in ASP.NET MVC 1.0. This blog application has Views like "Insert Post", "Edit Post", etc. I need to post a string containing HTML back to the appropriate controller method. That HTML value is being posted from a textarea.
I've read that it's necessary to disable ValidateRequest directly on the page with t...
I built a starter MVC app using strongly typed views to display table data from two identical databases in the same view (Index/list) by changing the connection string of the linq to sql dbml to switch between the two dbs and in debug mode I can see the change has taken place, but the view does not change to reflect the new data. I follo...
I've started using Portable Areas from the MvcContrib project. Everything works great with the exception of Visual Studio Intellisense. Has anyone been able to get their View intellisense to work...
Html. <-- does not exist in the current context.
I'm also not able to get intellisense on any of the models created in the same project......
Given following ASP.NET MVC controller code:
[HttpPost]
public ActionResult Create(FormCollection collection)
{
string[] whitelist = new []{ "CompanyName", "Address1", "Address2", ... };
Partner newPartner = new Partner();
if (TryUpdateModel(newPartner, whitelist, collection))
{ ...
Hi guys,
I've a little problem with an Html.ListBox.
I am developing a personal blog in ASP.NET MVC 1.0 and I created an adminpanel where I can add and edit a post!
During this two operations, I can add also tags.
I think of use an Html.ListBox() helper to list all tags, and so I can select multiple tags to add in a post! The problem ...
Hi everybody,
I am developing with NHibernate for the first time in conjunction with ASP.NET MVC and StructureMap. The CodeCampServer serves as a great example for me. I really like the different concepts which were implemented there and I can learn a lot from it.
In my controllers I use Constructur Dependency Injection to get an insta...