aspnetmvc
There are 10 entries for the tag
aspnetmvc
I have been following Rob Conery's posts on the MVC Storefront, and trying the repository/pipes-filters for data access that he has been using. While trying out the implementation of a LazyList he was using, I had noticed that the example table was being joined onto the category table. At the time however, I really had not thought much of it, until I read MVC Storefront: Brainbender Intermission which got me thinking. Admittedly, I don't really have to much of a problem with it loading all of the examples for all the categories at one time at the moment. However,...
posted @ Wednesday, May 21, 2008 12:34 AM |
I finally got around to updating the website to the MVC preview 2, and ran into a couple of things. TagBuilder being internal. While the implementation of it CreateInputTag, CreateTag and CreateAttributeList. The removal of .ToAttributeList() was actually what made me go looking for this. The HtmlExtensionUtility extension methods would have been nice to have also. I guess a better way to say it is it would be nice not to have to reimplement the functionality that CreateAttributeList and ConvertObjectToAttributeList already implement. It would be nice if SimpleForm inherited from a class, that could be subclassed to make...
posted @ Monday, March 17, 2008 10:49 PM |
I ran into a situation that reminded me of Steam Harman's post about A New Year's Resolution for Developers in which he states that by default methods should be public and virtual unless there is a good reason not to.
This started when after I decided I was missing functionality like RegisterClientScriptBlock, allowing me to add a client script only if one of the controls needs it, along with only adding it once. I was also missing the ability to use designers.
To this end, I decided I was going to make a simple server control library with server controls that would...
posted @ Friday, January 04, 2008 12:48 AM |
Its amazing how fast things can be done when not fighting bad assumptions. In this case it was that my admin URLs needed to use the nice descriptive URLs, instead of just /[Controller]/[Action]/[id] type routing. Once I realized I was making things overly complicated I, I ended up with a set of routing functions that are actually a bit less complicated then what I would have come up with if I had been able to extend the RouteTable the way I had planned originally. I also decided that I didn't like the idea of having the make every category and...
posted @ Monday, December 24, 2007 3:44 AM |
Well, Bill Pierce in his post about making the HttpContext wrapper use the application as a service provider got me to a good enough solution for the script service I had wanted in my previous post.
While not quite as clean as adding it to the HttpContext, I think an extension method on HttpApplication like this will work well for now.
public static object GetService(this HttpApplication application,Type service)
{
IServiceProvider provider = application as IServiceProvider;
if (provider == null)
return null;
return provider.GetService(service);
}
Then add/implement the IServiceProvider...
posted @ Tuesday, December 18, 2007 11:06 AM |
I was trying to determine the best way to secure my admin* actions when I thought of something I had only really seen while studying for my MCSD.Net exams, or maybe it was the MCPD upgrade exams I haven't gotten round to taking.
I decided to secure the admin controller actions using.
[PrincipalPermission(SecurityAction.Demand,Role="<Role>")]
Which I had never used even though I started programming .Net in during the beta of 1.0. And I have to admit that each time I run into something like this, it makes me feel that my thought in a previous post is right.
This works for my immediate...
posted @ Tuesday, December 18, 2007 1:22 AM |
After working on the login usercontrol, I decided that I wanted to add similar functionality to the navigation sections of the site for accounts/roles that didn't get ads displayed. So I needed a standard way to put dynamic sections into a page. I liked the syntax used by the form HtmlHelper methods, so decided to base it off of the SimpleForm class and ended up with this//Based on the SimpleForm class in MvcToolkit //Wish I believed I would have ever thought to use//IDisposable to do thispublic class SimpleWrappingTag : IDisposable{
protected string _beginTagFormat = "<{0} {1}>";
...
posted @ Sunday, December 16, 2007 12:32 AM |
Since administration was the next part I wanted to work on.
I decided that for the moment I just want a little login for in the upper corner like
I decided to put the login screen view logic into a user control, and added the following user control named Login.ascx and placed it into the Shared
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%if(!Page.User.Identity.IsAuthenticated) {%>
<form action="/Home/Login" method="post" id="LoginForm">
<span id="EmailLabel">Username:</span><br />
<%=Html.TextBox("Username")%><br />
<span id="PasswordLabel">Password:</span><br />
...
posted @ Friday, December 14, 2007 12:16 AM |
It turned out to be a lot easier to work around not being able to override the route parsing method then I had thought it would be last night. Though when they allow me to override that method I will be changing over. By setting up the following routes I was able to get almost the effect that I was looking for:RouteTable.Routes.Add(new Route
{
Url = "Example/[id]/[action]",
Defaults = new { Controller = "Example" },
RouteHandler = typeof(MvcRouteHandler)
});
RouteTable.Routes.Add(new Route
{
Url = "Example/[Category1]/[id]/[action]",
Defaults = new {...
posted @ Thursday, December 13, 2007 12:12 AM |
My first thought is, I really wish I could use this at work, but it is working nicely so far for my rewrite of my web site. Writing Classic ASP style again is taking a little getting used to again though, the visual preview from the designers made styling the page a lot nicer. The lack of control designers also seem like it would hinder having a graphics guy using Expression Web do the UI with MVC based web applications. But I have never worked with a graphics guy on a project that way anyway so I am could...
posted @ Wednesday, December 12, 2007 1:32 AM |