<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>adam mokan &#187; asp.net</title>
	<atom:link href="http://www.adammokan.com/category/development/dot-net/asp-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adammokan.com</link>
	<description>ramblings of a software developer, mad scientist, geek, and father</description>
	<lastBuildDate>Tue, 22 Nov 2011 19:11:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MVC Mini Profiler</title>
		<link>http://www.adammokan.com/2011/11/14/mvc-mini-profiler/</link>
		<comments>http://www.adammokan.com/2011/11/14/mvc-mini-profiler/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 18:07:37 +0000</pubDate>
		<dc:creator>adam.mokan</dc:creator>
				<category><![CDATA[asp.net]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[asp.net mvc3]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dot net]]></category>
		<category><![CDATA[nuget]]></category>
		<category><![CDATA[razor]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[asp.net mvc 3]]></category>
		<category><![CDATA[mvc-mini-profiler]]></category>

		<guid isPermaLink="false">http://www.adammokan.com/?p=82</guid>
		<description><![CDATA[I&#8217;ve started to use the very helpful Mini-Profiler in my apps and love the base functionality provided and optional approach to profiling specific portions of your application. It&#8217;s worth mentioning that Mini-Profiler is open source and used in production by the folks at StackOverflow, so feel confident that it is a solid assembly with plenty [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started to use the very helpful <a href="http://code.google.com/p/mvc-mini-profiler/" target="_blank">Mini-Profiler</a> in my apps and love the base functionality provided and optional approach to profiling specific portions of your application. It&#8217;s worth mentioning that Mini-Profiler is open source and used in production by the folks at <a href="http://stackoverflow.com" target="_blank">StackOverflow</a>, so feel confident that it is a solid assembly with plenty of options to meet your needs.</p>
<p>For those that haven&#8217;t checked it out, bring MiniProfiler into your application <a href="http://nuget.org/List/Packages/MiniProfiler" target="_blank">via NuGet</a> with a</p>
<pre>Install-Package MiniProfiler</pre>
<p>If you are working in a web project (MVC, WebForms), you simply add the following line of code in your head block <em>AFTER</em> your jQuery reference (this line is formatted as Razor for MVC 3) -</p>
<pre>@MvcMiniProfiler.MiniProfiler.RenderIncludes()</pre>
<p>One thing worth mentioning is that on IE9, I had some issues with the UI of the profiler displaying appropriately. I looked around and found a post mentioning adding the following to your CSS file and sure enough, it fixed my IE9 issue. So, give it a shot if you have any problems displaying the profile on Internet Explorer.</p>
<pre>div.profiler-popup
{
    overflow: visible !important;
}</pre>
<div id="attachment_86" class="wp-caption alignnone" style="width: 310px"><a href="http://www.adammokan.com/wp-content/uploads/2011/11/mini_profiler.png"><img class="size-medium wp-image-86" title="mvc-mini-profiler" src="http://www.adammokan.com/wp-content/uploads/2011/11/mini_profiler-300x93.png" alt="" width="300" height="93" /></a><p class="wp-caption-text">Mini-Profiler UI on a simple ASP.NET MVC 3 page</p></div>
<p>I&#8217;ve had success using this for profiling ASP.NET MVC3 applications as well as Entity Framework 4.2 &#8220;Code First&#8221; queries within the apps, which is great. I still really like the <a href="http://efprof.com/" target="_blank">Entity Framework Profiler</a> tool from Hibernating Rhinos and rely on it heavily, but Mini-Profiler does a good job of showing ORM query issues.</p>
<p>I plan to try this out with some old WCF projects in the near future as well. In the meantime, pop it into one of your development applications and make sure your code is performing how you expect.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adammokan.com/2011/11/14/mvc-mini-profiler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NuGet.Server sample project</title>
		<link>http://www.adammokan.com/2011/10/12/nuget-server-sample-project/</link>
		<comments>http://www.adammokan.com/2011/10/12/nuget-server-sample-project/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 17:35:26 +0000</pubDate>
		<dc:creator>adam.mokan</dc:creator>
				<category><![CDATA[asp.net]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dot net]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[nuget]]></category>
		<category><![CDATA[iis express]]></category>
		<category><![CDATA[nuget.server]]></category>
		<category><![CDATA[vs2010]]></category>

		<guid isPermaLink="false">http://www.adammokan.com/?p=80</guid>
		<description><![CDATA[A couple days ago I mentioned how simple getting an internal Nuget repository via NuGet.Server was. Apparently, it didn&#8217;t go as smooth for others as it did for me based on some replies and DMs. So, I setup a new sample project and pushed it to github for anyone to try. I have succesfully tested [...]]]></description>
			<content:encoded><![CDATA[<p>A couple days ago I mentioned how simple getting an internal Nuget repository via <a href="http://nuget.org/List/Packages/NuGet.Server" target="_blank">NuGet.Server</a> was. Apparently, it didn&#8217;t go as smooth for others as it did for me based on some replies and DMs.</p>
<p>So, I setup a new sample project and pushed it to github for anyone to try. I have succesfully tested this sample in IIS Express as well as IIS 7. Both had no issues after some minor adjustments. For IIS Express I do note some modifications in the README in the github repo that you should take note of. But simply cloning and running should get you going. Be sure, if you are in Visual Studio, that you tell the project to use IIS Express though.</p>
<p>Here is the link to the sample project on github - <a title="github.com/amokan/Nuget.Server-Sample-Project" href="https://github.com/amokan/Nuget.Server-Sample-Project" target="_blank">https://github.com/amokan/Nuget.Server-Sample-Project</a></p>
<p>The basic steps to create the project like I did were:</p>
<ol>
<li>Create a new &#8220;ASP.NET Empty Web Application&#8221; in Visual Studio.</li>
<li>Either use the GUI or NuGet Console to install the <a href="http://nuget.org/List/Packages/NuGet.Server" target="_blank">Nuget.Server</a> package.</li>
<li>Adjust the web.config, as needed.</li>
<li>Profit (or happiness&#8230; i&#8217;m not sure what&#8217;s motivating you here)</li>
</ol>
<div>Enjoy and hopefully this works for someone out there!</div>
]]></content:encoded>
			<wfw:commentRss>http://www.adammokan.com/2011/10/12/nuget-server-sample-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Presenting at the PCSUG on April 6th</title>
		<link>http://www.adammokan.com/2011/03/24/pcsug-april2011/</link>
		<comments>http://www.adammokan.com/2011/03/24/pcsug-april2011/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 19:52:44 +0000</pubDate>
		<dc:creator>adam.mokan</dc:creator>
				<category><![CDATA[asp.net]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[asp.net mvc3]]></category>
		<category><![CDATA[dot net]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[pcsug]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[soa]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[april 2011]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.adammokan.com/?p=63</guid>
		<description><![CDATA[On Wednesday, April 6th I will be presenting at the Phoenix Connected Systems User Group on utilizing ASP.NET MVC as an &#8220;alternative&#8221; to various web service options in the .NET stack (WCF, ASMX, etc). The group meets at Interface Technical Training near the corner of Thomas and Central in downtown Phoenix. More info can be [...]]]></description>
			<content:encoded><![CDATA[<p>On Wednesday, April 6th I will be presenting at the Phoenix Connected Systems User Group on utilizing ASP.NET MVC as an &#8220;alternative&#8221; to various web service options in the .NET stack (WCF, ASMX, etc).</p>
<p>The group meets at Interface Technical Training near the corner of Thomas and Central in downtown Phoenix.</p>
<p>More info can be found here &#8211; <a href="http://bit.ly/pcsug_apr11" target="_blank">http://bit.ly/pcsug_apr11</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adammokan.com/2011/03/24/pcsug-april2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ELMAH = awesome</title>
		<link>http://www.adammokan.com/2009/12/02/elmah-awesome/</link>
		<comments>http://www.adammokan.com/2009/12/02/elmah-awesome/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 07:00:00 +0000</pubDate>
		<dc:creator>adam.mokan</dc:creator>
				<category><![CDATA[asp.net]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[elmah]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://www.adammokan.com/2009/12/02/elmah-awesome/</guid>
		<description><![CDATA[So, I&#39;m a bit late to the game on this. But ELMAH (Error Logging Modules and Handlers) is awesome. Basically just drop the dll in your bin folder on your project and adjust your web.config. It handles your error handling and logging automatically. Very slick. I got it in place today on a couple apps [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#39;m a bit late to the game on this. But <a href="http://elmah.googlecode.com/">ELMAH</a> (Error Logging Modules and Handlers) is awesome.<br />
Basically just drop the dll in your bin folder on your project and adjust your web.config. It handles your error handling and logging automatically. Very slick.<br />
I got it in place today on a couple apps (ASP.NET webforms and ASP.NET MVC 2) and it writes to a SQL database (one of many options for logging).<br />
But, as with most things I mess with, its not enough (and not its own fault). I have an internal system already in place for tracking and managing our applications. I setup the ELMAH table in the same database as my tracking app and want to have a way to tie them together. So, now I am modifying the Error.cs class in the Elmah source to allow me to put the ApplicationID in the web.config so I can query the Elmah error table in relation to my existing application metrics.<br />
I highly recommend checking this little utility out if you&#39;re doing .NET development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adammokan.com/2009/12/02/elmah-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery autocomplete plugin with ASMX web service and JSON</title>
		<link>http://www.adammokan.com/2009/11/04/jquery-autocomplete-plugin-with-asmx-web-service-and-json/</link>
		<comments>http://www.adammokan.com/2009/11/04/jquery-autocomplete-plugin-with-asmx-web-service-and-json/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 07:00:00 +0000</pubDate>
		<dc:creator>adam.mokan</dc:creator>
				<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[soa]]></category>
		<category><![CDATA[asmx]]></category>
		<category><![CDATA[autocomplete]]></category>

		<guid isPermaLink="false">http://www.adammokan.com/2009/11/04/jquery-autocomplete-plugin-with-asmx-web-service-and-json/</guid>
		<description><![CDATA[I&#8217;m trying to find more reasons to switch a lot of my js/ajax ui over to jQuery recently. This is due to my excursions into Rails and Sinatra outside of work, and also because I feel like some of the MS Ajax Toolkit extenders seem to be bloated at times. I also figure that since [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to find more reasons to switch a lot of my js/ajax ui over to jQuery recently. This is due to my excursions into Rails and Sinatra outside of work, and also because I feel like some of the MS Ajax Toolkit extenders seem to be bloated at times. I also figure that since I intend to dip my feet more into the ASP.NET MVC framework, jQuery seems to be very standard there.&nbsp;</p>
<p>That brings me to (one of) the jQuery Autocomplete plugins. I need this functionality in an ASP.NET webforms application and wanted to give it a shot. I started messing with &#8220;jQuery Autocomplete plugin 1.1&#8243; by Jörn Zaefferer. You can find the code and info at&nbsp;<a href="http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/">http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/</a>.&nbsp;</p>
<p>I&#8217;m mostly interested in doing an autocomplete via a remote web service call that returns json data. The example in the zip file includes a little php page that just responds to a HTTP-GET and spits out some hard-coded json. I&#8217;m working in .NET, so I made a simple ASMX web service to query my database and return a DataTable as json. (Note &#8211; There are isues with the built-in serializer to return a DataTable as json. A google search will find you a number of functions or alternate ways to generate a json string from a DataTable.)&nbsp;
</p>
<p>Right away, I found I was having problems with the autocomplete in this environment. First off, you have the whole issue with ASMX web methods only accepting a POST by default. This is easy to change, but not advised. You can find info on that issue here &#8211; <a href="http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/">http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/</a> and some other good info here &#8211; <a href="http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/">http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/</a>&nbsp;
</p>
<p>You&#8217;ll also notice in the above blog links that there can often be issues when POST-ing to a web method with encoding set to json, that you will need to pass your json params as a string. If you&#8217;re using something like Firebug to watch your ajax posts, you&#8217;ll catch this right away.&nbsp;
</p>
<p>But the main issue for me were&nbsp;the assumptions that the autocomplete plugin makes. It, by default, will only do a HTTP-GET. You can use the $.ajaxSetup in jQuery to set your future ajax calls to a default, but I wanted the ability to make this decision when calling the autocomplete plugin.&nbsp;
</p>
<p>I made these changes to jquery.autocomplete.js in the $.ajax section :</p>
<pre class="brush: js; highlight:[7,8,9,10];">
$.ajax({
// try to leverage ajaxQueue plugin to abort previous requests
mode: "abort",
// limit abortion to this input
port: "autocomplete" + input.name,
dataType: options.dataType,
//setup new options for asmx - amokan
type: options.httpMethod,
contentType: options.contentType,
//end new options - amokan
url: options.url,
</pre>
<p>This allows me to now handle my client side code a little better.</p>
<pre class="brush: js; highlight:[5,6];">
$("#task").autocomplete(
"http://somecomputername/jsonServiceTest/Testing.asmx/GetSomeDataNoParam",
{
dataType: 'json',
httpMethod: 'POST',
contentType: 'application/json; charset=utf-8',
max: 100,
scroll: true,
matchContains: true,
minChars: 3,
parse: function(data) {
var rows = new Array();
//your parsing logic
},
formatItem: function(row, i, n) {
//do something
},
width: 260
}
);
</pre>
<p>I&#8217;m still working on cleaning up the data parameter section of the plugin a bit before I post the full code.<br />
If you&#8217;re curious, here is my ASMX method. Be sure to add the [ScriptService] attribute to your class in the ASMX file so it can handle AJAX properly. If you are using an older .NET without the System.Web.Script.Services namespace, this will not work for you. Note that the parameters &#8220;q&#8221; and &#8220;limit&#8221; are sent automatically by the autocomplete plugin. &#8220;Q&#8221; is the string currently typed into the text control so you can filter your query based on what the user has typed and &#8220;limit&#8221; is the max number of rows. Obviously, its up to you to implement these in your query if you chose to. &nbsp;</p>
<pre class="brush: csharp">
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public string GetSomeDataNoParam(string q, int limit)
{
DataTable dtSomething;
//connect to db, do your exception handling, etc
dtSomething = //your DAL or whatever you use
//use my method to parse the datatable into json
return GetJSONString(dtSomething);
}
</pre>
<p>Hope this helps a bit and I will be sure to upload some more code as I get this working a bit smoother in my environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adammokan.com/2009/11/04/jquery-autocomplete-plugin-with-asmx-web-service-and-json/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

