Thoughts from Dan Miser RSS 2.0
# Sunday, 01 December 2013
Trying to follow the directions to host your own Nuget server, I ran into a couple small problems when trying to deploy it to a Virtual Application within an Azure WebSite. I was able to successfully deploy this inside the Virtual Application using my previously posted directions. But I still found these issues:

1. The URL was actually requiring a second nuget appended to the end (i.e. http://www.mydomain.com/nuget/nuget/).
2. When accessing the required URL above, I received this error:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. 
If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true 
or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.

The solution was to update the web.config to add this attribute to the element that was already there.

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>


Sunday, 01 December 2013 21:51:33 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | ASP.NET
# Saturday, 23 November 2013
Azure has been churning out features faster than anything I can ever remember coming out of Microsoft. I finally moved to Azure with my production apps this weekend. It was a pretty painless move, as far as data center moves go. One of the biggest road blocks that I hit was trying to create virtual applications for each of my apps inside one Azure Web Site. I wanted to go this way to get the benefits of having one DNS entry, coupled with an SSL certificate, and eventually wildcard subdomains. It seemed the smart way to go, given that each app is isolated and I've been running that way on my own IIS server for a couple years (or more) now.

The key to getting things right is to select your Azure Web Site in the portal, and go to Configure. Then, at the bottom of the page you can add your virtual applications. The placeholder text says "PHYSICAL PATH RELATIVE TO SITE ROOT". Don't listen to that. Instead, make your virtual applications live underneath site\wwwroot.


If you do that, you can then download the Publish Profile Settings from your dashboard and update the <DeployIisAppPath> element to look like this: 
<DeployIisAppPath>MySite/app1</DeployIisAppPath>
Now when you deploy, the files will land on the server in the right directory. 


I couldn't find a way to get the deploy to put the files in the site\app1 directory on the server. DeployIisAppPath and RemoteSitePhysicalPath could not get me up to that level in this setup. If you know of a better way, I'd love to hear about it!

Bonus: If you're a command line junkie like me, you'll want to read how to publish an Azure site from the command line.
Saturday, 23 November 2013 23:40:46 (GMT Standard Time, UTC+00:00)  #    Comments [1] -
.NET | ASP.NET | ASP.NET MVC
# Sunday, 08 January 2012
Martijn Boland provides us with a nice way to display message banners in an ASP.NET MVC application. I highly recommend checking out his blog post and code sample.

Sunday, 08 January 2012 22:33:36 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
ASP.NET
# Tuesday, 22 February 2011
The Web Platform Installer (WPI) is really nice when it works. But when it doesn't, it's a battle to the death to get things to work. Case in point: I was trying to install php on my Windows 2008 Server through WPI, but it would go on forever during the FastCGI install step. I looked at logs and the Event Viewer, and searched google. A lot of people reported a similar problem, but there was no definitive recipe to get past the problem.

In the end, I just clicked on the link for FastCGI in the installation details window of WPI, and installed that piece manually. It went through without a hitch. After a restart (which the FastCGI installer required), I installed php from WPI, and it installed the 4 remaining pieces without a hitch, and it did so quickly. So just a note that if WPI starts acting up, just install the problematic piece manually and then let WPI continue.

Tuesday, 22 February 2011 04:04:52 (GMT Standard Time, UTC+00:00)  #    Comments [1] -
.NET | ASP.NET
# Wednesday, 02 February 2011

For an ASP.NET MVC application, consider the following code fragment, where GetDetails will return HTML markup:


<%using (Ajax.BeginForm("GetDetails", new AjaxOptions { UpdateTargetId = "result" })) { %>
  <input type="submit" />
<% } %>
<span id="result" />

This code works beautifully in Firefox and Chrome, but in IE (at least 7 and 8), it ends up chewing up parts of the master page, wreaking havoc on the layout of the rendered page. The problem is that the span tag is a void element (it only has a start tag). If you physically specify the span as a start and end tag, e.g. <span id="result"></span>, then the code will work fine in all 3 browsers.

I was tempted to blame IE, and I still sort of do, but at least they're handling the HTML spec properly. w3.org clearly specifies that the span tag is not allowed to be a void element (search within the page for "void element" to see the list of allowed void elements), and it's consistent on the span reference page. The reason I still sort of blame IE is:

  1. Mozilla and Chrome understand that a void span element can be expanded in to start and end tags
  2. A void span element works just fine if it's enclosed in another HTML element, e.g. <td><span id="result" /></td> will display the returned HTML just fine
  3. When looking at the rendered page with IE Developer Tools, if a void span element is encountered in a content page, they go back to the master page and stuff the rest of the master page in the span. I guess they're free to implement malformed HTML anyway they like, but this just seems crazy.

The takeaway: All of this due to a missing end tag for a span. Ugh!

Wednesday, 02 February 2011 02:49:29 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
ASP.NET | ASP.NET MVC
# Friday, 06 November 2009
I've never been happier that I chose a technology after today. I have a production web application built using ASP.NET MVC, and it has been working with almost no issues for over a year now. As a matter of fact, it is the cornerstone used to run our business. I've had the default blue skin in use since day 1 (ya, ya, I know, I know. I've been so lazy, I haven't even switched out to pre-built templates), and we run the app on the iPhone. It works, but there's always pinching, zooming and scrolling going on. I finally bit the bullet after thinking to myself "Why not create a view tailored to the iPhone to enhance the experience?" one too many times. About 12 hours later, the entire application was done with an auto-detected, optimized look and feel for the iPhone. I am now convinced that I've just been paid back with the technical dividends for investing in ASP.NET MVC. :)

To help the next guy out who walks down this path, here are all of the links that I used during this process:

Friday, 06 November 2009 23:44:02 (GMT Standard Time, UTC+00:00)  #    Comments [1] -
ASP.NET | ASP.NET MVC
# Tuesday, 13 October 2009
Since my last post, the date has changed from October 9th to October 12th. The reason this is important is that the functions that needed to calculate the date based on the current date are now coming through a different code path. Before, everything worked great. As of October 10th, not so much. The fix is simple - the getDate function was missing the parentheses to make it a method call. The fix is quite simple and is listed below:

var day = (now.getDate() < 10) ? "0" + now.getDate() : now.getDate();
Tuesday, 13 October 2009 05:11:13 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
ASP.NET | ASP.NET MVC
# Friday, 09 October 2009
I have several reports in my ASP.NET MVC application that are date-oriented. I had start date and end date text boxes, and things worked fine. What I really wanted was something that would allow those date boxes to be populated with a variety of canned date ranges (e.g. Year to Date, Last Month, etc.). I found just what I was looking for in a pure JavaScript implementation here.

The one problem I found was that "Last Month" was being calculated incorrectly. Below is the simple fix. Thanks to epalla for the original code.


// last month 
case "lastmo":
    // we need a new month variable for month-1, also formatted correctly
    var lastmonth = ((month - 1) < 10) ? "0" + (month - 1) : (month - 1);
    startbox.value = lastmonth + "/01/" + year;

    // now grab the last day of the month (30, 31? we don't know!)
    var moend = new Date(year, (month - 1), 0);
    endbox.value = lastmonth + "/" + moend.getDate() + "/" + year;

    break;
Friday, 09 October 2009 02:44:07 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
ASP.NET | ASP.NET MVC
# Thursday, 29 January 2009

There were a few changes between ASP.NET MVC Beta and RC1 regarding list binding. For background on list binding, look at Phil Haack's excellent article. Here are the changes that I saw, some good, and some bad:

  • You no longer need to specify the ".index" hidden field. This is good, as it's one less hidden field to take care of.
  • Binding occurs automatically for lists of complex types, but you must have contiguous numbering of the elements, starting with zero. This means that you can no longer specify the index with things like key information. I'm not wild about this change.
  • In the Beta release, binding would only occur for properties of IList. I've been using LightSpeed lately, and that means my property looks like this: EntityCollection<FooType> FooProperty. EntityCollection supports IList, but because it wasn't truly an IList in the class declaration, the default binding didn't work. In the Beta release, I got around this by adding a mirrored property of IList<FooType> and then copying the data over to FooProperty in my controller method.
  • Nested property references, e.g. Foo.Bar, now get the resulting input id renamed to Foo_Bar. This makes it easier to work with jQuery selectors on these elements.

All in all, I'm really liking the RC1 release. I'm looking forward to the release!

Thursday, 29 January 2009 00:04:53 (GMT Standard Time, UTC+00:00)  #    Comments [1] -
ASP.NET
# Friday, 16 May 2008
When deploying an ASP.NET web site to IIS 6 on a Windows 2003 server, you may encounter 404 errors when trying to access the aspx pages. The quick solution is to Allow ASP.NET extenstions from the IIS Admin Web Service Extensions node. Neil Kilbride has a much more comprehensive writeup on this here.
Friday, 16 May 2008 15:38:13 (GMT Daylight Time, UTC+01:00)  #    Comments [1] -
ASP.NET
# Tuesday, 15 April 2008

If you want to add Membership Provider features to your WebHost4Life application, I've found that you can't use the aspnet_regsql wizard UI. Instead, use the following code at the command prompt:


aspnet_regsql -C "Data Source=sqlNNN.mysite4now.com;Initial Catalog=yourdb;User Id=yourUserName;Password=yourPwd" -A mr

Replace NNN with your assigned address, and obviously replace the other elements of the above connection string, too. :-)

Tuesday, 15 April 2008 22:12:01 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
.NET | ASP.NET
# Tuesday, 25 March 2008

Problem: I have written my own membership provider to store and validate user information. Further, I have a web page that allows a user to come and sign up with a username, password, and a whole host of other client-related data. When the user submits that data, I would like to have them logged in.

Solution: Since I'm using Forms authentication for the ASP.NET website, it appears that the following code-snippet does what I want:

if (Membership.ValidateUser(u.UserName, u.Password))
    FormsAuthentication.SetAuthCookie(u.UserName, false); 
Tuesday, 25 March 2008 20:24:17 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | ASP.NET
# Friday, 07 March 2008

ASP.NET MVC Preview 2 was released yesterday. I've had a chance to install and play with it, and I hate to report that I am underwhelmed. My thinking leads me to believe that MS rushed this release out the door just to be able to say they shipped something at MIX. While there has been good progress made on several issues (e.g. medium-trust support, public methods are callable by default, and route setup is improved). However, I find several other things lacking, referenced from ScottGu:

  1. Source code is not released. Sure, it might be coming "soon", but why not have everything coordinated and ready to go? Hitting an arbitrary deadline of "ship while at MIX" is less important to me than having answers to questions like these.
  2. Dynamic Data (scaffolding) will not work with Preview 2. It is almost always inexcusable to take functionality and features away. The ability to scaffold is one of the coolest things in Rails. Having something similar in ASP.NET was a welcome treat. Now it's gone. Again, I'm sure there is something that will be released "soon", but why not have everything ready to go? I hate not only playing catch up years later, but having a taste of it, only to have it yanked a few weeks later.
  3. The "choose your unit testing framework" feature that was hyped up ships with only MSTest enabled. I understand that MS is working to enlist support from the various unit testing groups to add their tool to the list, but it seems disingenuous to post mocked up screen shots with test frameworks in a combo box that were never developed.
  4. Others have pointed out some more detailed issues that need solving to help with testability (e.g. see here and here).

I look forward to seeing these issues addressed ASAP because I absolutely LOVE the promise that the MVC bits hold.

Friday, 07 March 2008 19:30:33 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | ALT.NET | ASP.NET
# Monday, 10 December 2007

At the risk of another "Me, too!" post, I thought I'd highlight several links that I have found to be helpful, and for a value-added bonus, talk about why this release matters to me. Back in the day (oh boy, does that make me sound old!), I learned how to program for the Internet by using straight HTML and Delphi to create CGI and ISAPI extensions. In order to do this, you needed to be quite aware of how the actual protocols worked, and what to do to make things behave as you'd expect. I stayed with web development up until I was using COM objects (again, written in Delphi) from an ASP page. After that, I wasn't into the web development scene much on a full-time basis.

ASP.NET 1.0 and 2.0 came along, and I found them to be quite daunting. It seemed as if it was framework built upon framework, layered with add-ins to do what I thought used to be simple things.

It appears to me that there has been a resurgence to move away from the barrage of constant abstractions, and to instead embrace the simplicity of the web (see the popularity of REST, Rails, and the buzz around ASP.NET MVC for some examples of this).

So for me, the reason I am excited is that not only can I once again utilize my knowledge about how the web works, but I can use it in new ways that will make my applications even better (e.g. TDD, scaffolding, etc.). At any rate, here's the set of links that I think matter for ASP.NET MVC:

Monday, 10 December 2007 20:40:56 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | ASP.NET
# Wednesday, 22 August 2007
I was getting a strange problem at a client's site recently where on occasion, an ASP.NET application that called a web service would throw different exceptions. The fact that I could claim "It works on my machine" meant little consolation. Stranger still, when debugging the application, it would blow up at different spots. When it finally blew up on a call to Response.Redirect, the client suddenly remembered some code that he used in a similar situation before. The theory was that there is some kind of misconfiguration in the servers somewhere, so this should not be needed, but this work-around has since been added and no additional errors have been reported.



// svc is a WebService that you would use in your ASP.NET application

svc.Proxy = new System.Net.WebProxy("127.0.0.1");

((System.Net.WebProxy)svc.Proxy).BypassList = new string[] { "NameOfLocalMachine" };

Wednesday, 22 August 2007 19:02:12 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
.NET | ASP.NET
Navigation
Archive
<2017 June>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Dan Miser
Sign In
Statistics
Total Posts: 388
This Year: 0
This Month: 0
This Week: 0
Comments: 630
Themes
Pick a theme:
All Content © 2017, Dan Miser
DasBlog theme 'Business' created by Christoph De Baene (delarou)