I've read through the posts and code for passing ASP.NET MVC HandleError errors to ELMAH and converted the code to VB:
Imports System
Imports System.Web
Imports System.Web.Mvc
Imports Elmah
Public Class HandleErrorAttribute
Inherits System.Web.Mvc.HandleErrorAttribute
Public Overrides Sub OnException(ByVal context As ExceptionC...
Consider:
public class HomeController : Controller {
private IDependency iDependency;
public HomeController(IDependency iDependency) {
this.iDependency = iDependency;
}
}
And the fact that Controllers in ASP.NET MVC must have one empty default constructor(*) is there any way other than defining an empty (and usel...
No javascript\AJAX is to be used.
...
I need to generate a link to an action and send the link by email. I'd like to call something like this:
public string GetAbsolutePath(string actionName, string controllerName, string id)
{
// Somehow generate the absolute path
}
I think I can use VirtualPathUtility.ToAbsolute(string virtualPath) but I'm not sure how to get the vi...
Hi,
Like everybody else on this planet, I am currently working on a blogging engine using ASP.NET MVC .
I am planning to make this open source under GPL, with a requirement that people already have ASP.NET 3.5 already installed on their machines. Let us say that they do not already have ASP.NET MVC installed (on a shared host)
But, I...
Name:
<%= Html.TextBox("txtName", "20", new { @class = "hello" }) %>
I want that in VB.NET , is it .cssclass="hello" or is it something else?
...
hello
I have a problem to get the values and text of the MultiSelectList to work. It gets rendered as:
<select id="UsergroupID" multiple="multiple" name="UsergroupID"><option>BookingSystem.Data.Models.Usergroup</option><option>BookingSystem.Data.Models.Usergroup</option><option>BookingSystem.Data.Models.Usergroup</option></select>
An...
I am looking for a good way to track down every change that is made on an object.
We are building a custom framework and we need to have a history (kind of) about who changed which object when and maybe also what.
What is a good practice in this case?
Extend the save / update methods to write a "log"?
Should I try with log4net or kin...
Hello
I have created a MultiSelectList like this:
MultiSelectList UsergroupID = new MultiSelectList(_ug.GetUsergroups(), "UsergroupID", "UsergroupName", u.Usergroups);
problem is the getting the list from u.Usergroups (that is EntitySet) to make the items selected.
Do I need to cast "u.Usergroups" to something in order for it to sel...
I have a controller view which lists recent comments. I also have a textbox and button to add a new comment.
When I post to the Save action, I need to validate the textbox.
However if the validation fails, when returning to the view, I also need to reload all the comments all over again, which feels like an unnecessary db call.
Example...
ScottGu says .NET MVC 2.0 has built in DataAnnotation support, I think that means I don't need to download the DataAnnotation DLLs separately, but when I installed MVC 2.0 and try to use System.ComponentModel.DataAnnotations, my VWD prompts an error message:
...
I'm in early phase of building a RIA with ExtJS and ASP.NET MVC.
Users in the system will have numerous different user rights that restrict which elements are visible and what actions user can make.
For example in the user managment section, only superuser should be able to promote user to 'admin' status. So the 'add admin status' -b...
Does anyone know how to code up long-polling AJAX requests (for server PUSH notifications) in ASP.NET MVC? Whenever I do it, it seems that only the last browser to open up a window gets the notifications. As if IIS/ASP.NET were canceling the last request because it was hung or something.
...
When creating a new entity object that has a foreign key value I need to create a new Entity key (Entity Framework in .net 3.5) for the object, but I'm having trouble deciding where in my application I should do this.
Right now when I create a new record with a foreign key, I create the entity key in the controller (in this case a user ...
What does the castle validators offer me over standard data annotations?
I am a first-time user of xVal, data annotations and castle validators so there will be a learning curve regardless of which I decide. Is it worth it to just start using casle validators (I'm assuming they will be more robust)
...
Earlier today we experienced a YSOD on one of our MVC sites running on IIS on Windows Server 2003.
Usually, these are reported via e-mail using ELMAH (using this setup), but since this was a compilation issue (of some sort), it did not get reported via e-mail.
The specific error was:
"The directory 'App_GlobalResources'
is not a...
Hello
I have a problem with getting my pager-function to work. For some reason it doesnt like when I try to pass the current pageindex +1 to the same page for it to display next one.
<% if (Model.Users.HasNextPage) { %>
<%= Html.RouteLink(">>>", "Users", new { page = (Model.Users.PageIndex +1) })%>
<% } %>
If I only use: ”>...
Hi,
Who's responsibility is it to encode a string, the model or the view?
I've a string from a database, it's come from the user - I want to keep as a much information as possible in the database, so I'm saving the input verbatim.
When I come to display the string, should I be encoding it when I populate the view model, or should the ...
I was looking at this SO question: http://stackoverflow.com/questions/1168215/ado-net-entity-framework-update-only-certian-properties-on-a-detached-entity. This was a big help for me. I know now that I need to attach an entity before making my changes to it. But how can do I do this:
I have an MVC website, a Customer Update Page with fi...
Hello,
I made a new action filter (attribute, similar to [Authorize]) which authorizes access to a controller action based on a session value. However, I'm basically decorating all my controller actions with that attribute (with the exception of very few).
So, I thought it would be better to have that Action Filter always executed exc...