I have a number of interfaces I use to pass business objects around in my application. Using Ninject, I can do whatever I want with them without needing to know the type of the actual object; in this case, most of them are actually various Linq to Sql objects that implement the interface.
For example, I have a Linq to Sql object called ...
The following snippet has worked for validating user entered html snippets for ages, now in past day it started rejecting everything.
public override bool IsValid(object value)
{
var isValid = true;
try
{
var doc = new XmlDocument();
doc.LoadXml(string.Format(@"
<!DOCTYPE html [<!ENTITY % xhtml-l...
Hi guys,
It's been a long day and I seem to have drawn a blank with my current issue. Below is code contained in my HomeController:
public ActionResult About()
{
SqlDataReader rdr;
string fileName = "";
const string connect = @"Server=localhost;Database=Images;user id=user; password=passwor...
I need to generate html (for the body of an email message) specific to a Customer object
I thought of making a View that gets a Customer object and renders the appropriate text.
Is there a way to call a view and get the rendered output without associating it to a controller action?
Ideally in pseydocode I would do something like this
...
Is there a way to restrict the options available in the view data class select list in the MVC add view dialog box. I really would only like to have models from a single assembly in it?
...
I currently have 2 filters, Auth and Redirect that do the following: Filter Auth, who implements IAuthorizationFilter and ActionFilter, checks for user login and authorization, and if that fails sets the filterContext.Result to be a HttpStatusCodeResult of 403 (forbidden). Filter Redirect, who implements IActionFilter and ActionFilter, ...
I saw a similar question here on SO but I believe mine differs a little a bit.
OK, so I have a simple view here:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<RootFinder.Models.QuadCalc>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Po...
Hello, I am looking for learning materials (like blog posts and tutorials) for ASP.NET MVC 3.0 specific materials.
If you know of any books, blogs, sites or online resources that are exclusively, predominently or even mainly MVC 3.0 related, I would love to hear about them, also, specific links to individual MVC 3.0 related tutorials & ...
My ASP.NET MVC web application is supposed to calculate the roots of a second-degree polynomial (quadratic) but I'm erroneously getting Nan responses. I believe this is due to my improper setup, so let me post some of my code here:
View:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.M...
I have the following code:
Unity Container:
Settings settings = CreateSettings();
container.RegisterInstance(settings)
.RegisterType<MyHttpHandler>(new InjectionProperty[]
{
// How do I tell Unity to inject my settings created above?
new InjectionProperty("Settings", new Resolved...
So, I put all this logic in my view, thinking it would be helpful to follow the DRY principle.
Basically, this replicates a paper form, and in my view model, I have pairs of properties named like XXXCondition and XXXComment which put together form an InspectionDetail in my actual model.
<table>
<% string secname ="";
fo...
Is it possible to add the unit testing functionality (in Visual Studio 2010 Web Developer Express) for an already existing ASP.NET MVC project?
...
I'm using ASP.NET MVC, SQL Server 2008 and Forms Authentication. Suppose I am building a question-answer site like SO.
Here is the issue I am running into:
Users can view almost all the questions when not logged in, like they can on SO. Question-fetching query etc is almost written.
Now, if a user is logged in, he should also be ab...
Im sending a list from my controller class to my View which contain a list of values of type long. Now i want to traverse on that list in jquery to be able to view these values and perform my next operation. Im using Asp.net mvc and jquery. how to convert it so i can access each value?
...
I am going to make a smaller website in MVC.NET, mostly to learn how to work with the MVC.NET framework. I can't decide if I should use NHibernate or Linq2Sql as my Data Access Layer. Linq2Sql would much easier and faster to setup, but it doesn't have the capabilities as NHibernate (2 layer caching etc.).
So would it be wiser to use mor...
I am deploying a Asp.Net MVC 2.0 application on IIS 6.0. When I request any page I get the following error.
Parser Error Message:
Could not load type 'System.Web.Mvc.ViewMasterPage<dynamic>'.
Source Error:
Line 1: <%@ Master Language="C#" Inherits=
"System.Web.Mvc.ViewMasterPage<dynamic>" %>
Line 2: <%@ Import N...
I have a weird problem with EditorFor in one of my views. The following code throws an ArgumentNullException.
<%: Html.EditorFor(x => x.Name) %>
However, the following code is fine.
<%: Html.TextBoxFor(x => x.Name) %>
Model.Name is a string variable - and it's set.
EditorFor works in another view - until this view crashes, at whi...
on each controller call i have a code that gets some user properties from a webservice. I want to cache these for each user so i only hit the webservice once.
what is the best way to cache code in a controller method so it will allow me to avoid hitting the database on every URL request but also not cache one users info when another us...
One question I have yet to find an answer on is this. How do I keep track of active Sitemap nodes on multiple levels?
For example :
node 1
node 2 "active"
Child node 1
Child node 2 "active"
node 3
How do I keep track of a childnode being active as well as the parent it belongs to being marked as active.
I know there is ...
I was looking at the Golden 7 Restful Actions viz.
Index
New
Delete
Update
Create
Edit
Show
Now, I'm totally confused and not really sure if all of these are exclusive? For instance,
what is the difference between Index and Show, New and Create or Edit and Update? Are they essentially the same? Does that mean, we have just 4 golden ac...