<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Scott Klueppel's Blog - ASP.NET</title>
    <link>http://offroadcoder.com/</link>
    <description>making the hard line look easy</description>
    <language>en-us</language>
    <copyright>Scott Klueppel</copyright>
    <lastBuildDate>Mon, 01 Feb 2010 02:50:19 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>me@offroadcoder.com</managingEditor>
    <webMaster>me@offroadcoder.com</webMaster>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=5d833e28-847b-41a8-905f-549b0f6c1f84</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,5d833e28-847b-41a8-905f-549b0f6c1f84.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,5d833e28-847b-41a8-905f-549b0f6c1f84.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5d833e28-847b-41a8-905f-549b0f6c1f84</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’m not sure if what I’m doing is actually the right way to create a “user control”
in ASP.NET MVC, but it’s worth sharing this tidbit either way. Instead of using a <em>MVC
View User Control</em> to create a hidden field, a text box, two anchors, and three
JavaScript functions, I chose to put it all in a <em>HtmlHelper</em> in which I write
out the HTML and JavaScript myself. Everything worked fine except the almost magical
auto-repopulating of the hidden and text fields after a post that didn’t work as expected
as in a typical <em>MVC View Page</em>.
</p>
        <p>
          <strong>The situation:</strong> I have a page that needs to be called as a popup from
many pages in my MVC application. The page allows single or multiple selection of
“items” driven by an XML file. In the event that one day, almost always immediately,
I have two or more of these “controls” on one view page, I need the two fields and
the three JavaScript functions to have unique names so they don’t cross paths and
cause unexpected behavior. I had an <em>ASP.NET User Control</em> to do this in plain
old ASP.NET (POAN) since v1.1, and I can’t live without it. 
</p>
        <p>
          <strong>The confusion:</strong> If I were to place the hidden, textbox, anchors, and
JavaScript functions directly in the calling page, something magical happens after
a post. If the controls had values before the post, they appear to magically retain
there values after the post. It wasn’t until a colleague of mine, Sat, and I dug into
Reflector for a while did we realize what was happening. Html.TextBox, Html.Hidden,
and others all do something similar to auto-magically re-populate their values after
the post. Since I’m writing out my fields as &lt;input type=”hidden”/&gt; and &lt;input
type=”text”/&gt;, the magic doesn’t happen.
</p>
        <p>
          <em>      NOTE: The magic will also not happen if you just
write &lt;input type=”text”/&gt; on the page. It only happens if you use Html.TextBox.</em>
        </p>
        <p>
          <strong>The solution:</strong> I am still new to MVC and still trying to wrap my head
around the “right way” to do things. Reflector showed that the <em>HtmlHelpers</em> all
looked at the ModelState in the ViewData before rendering their HTML. They looked
for their value by key (key being the control/tag name), and, if present, used that
as the control/tag’s value. Bing! Maybe I should do the same thing. So just before
I go to town with TagBuilder to assemble my controls/tags, I look in the ViewData’s
ModelState for my value. If it is there, it must have been posted there by me (my
control).
</p>
        <div style="width: 650px; font-family: consolas; background: #3f3f3f; color: #dcdccc; font-size: 9pt">
          <p style="margin: 0px">
            <span style="color: #85ac8d">   48</span>         <span style="color: #2b91af">UrlHelper</span><span style="color: #dfdfbf">urlHelper</span> = <span style="color: #e1e18a; font-weight: bold">new</span><span style="color: #2b91af">UrlHelper</span>(<span style="color: #dfdfbf">helper</span>.<span style="color: #dfdfbf">ViewContext</span>.<span style="color: #dfdfbf">RequestContext</span>);
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   49</span>         <span style="color: #e1e18a; font-weight: bold">string</span><span style="color: #dfdfbf">textValue</span> = <span style="color: #e1e18a; font-weight: bold">null</span>;
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   50</span>         <span style="color: #2b91af">ModelState</span><span style="color: #dfdfbf">state</span>;
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   51</span> 
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   52</span>         <span style="color: #e1e18a; font-weight: bold">if</span> (<span style="color: #dfdfbf">helper</span>.<span style="color: #dfdfbf">ViewData</span>.<span style="color: #dfdfbf">ModelState</span>.<span style="color: #dfdfbf">TryGetValue</span>(<span style="color: #dfdfbf">textFieldName</span>, <span style="color: #e1e18a; font-weight: bold">out</span><span style="color: #dfdfbf">state</span>))
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   53</span>        
{
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   54</span>             <span style="color: #dfdfbf">textValue</span> = <span style="color: #dfdfbf">state</span>.<span style="color: #dfdfbf">Value</span>.<span style="color: #dfdfbf">AttemptedValue</span>;
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   55</span>        
}
</p>
        </div>
        <br />
        <p>
Works like a charm! Now my hidden, textbox, two anchors, and three JavaScript functions
are bundled nicely inside of an <em>HtmlHelper</em> class that looks and feels like
I’m using a built-in ASP.NET MVC <em>HtmlHelper</em> class. Most importantly, I have
the pleasure of typing only this on all my consuming pages.
</p>
        <div style="width: 650px; font-family: consolas; background: #3f3f3f; color: #dcdccc; font-size: 9pt">
          <p style="margin: 0px">
            <span style="color: #85ac8d">   40</span>     <span style="background: #ffee62; color: #000">&lt;%</span><span style="color: #efef8f">=</span><span style="color: #dfdfbf">Html</span>.<span style="color: #dfdfbf">MySelector</span>(<span style="color: #c89191">"selectedIDs"</span>, <span style="color: #c89191">"selectedNames"</span>, <span style="color: #c89191">"State"</span>)<span style="background: #ffee62; color: #000">%&gt;</span></p>
        </div>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=5d833e28-847b-41a8-905f-549b0f6c1f84" />
      </body>
      <title>Auto-populating ASP.NET MVC “controls” after a post</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,5d833e28-847b-41a8-905f-549b0f6c1f84.aspx</guid>
      <link>http://offroadcoder.com/2010/02/01/AutopopulatingASPNETMVCControlsAfterAPost.aspx</link>
      <pubDate>Mon, 01 Feb 2010 02:50:19 GMT</pubDate>
      <description>&lt;p&gt;
I’m not sure if what I’m doing is actually the right way to create a “user control”
in ASP.NET MVC, but it’s worth sharing this tidbit either way. Instead of using a &lt;em&gt;MVC
View User Control&lt;/em&gt; to create a hidden field, a text box, two anchors, and three
JavaScript functions, I chose to put it all in a &lt;em&gt;HtmlHelper&lt;/em&gt; in which I write
out the HTML and JavaScript myself. Everything worked fine except the almost magical
auto-repopulating of the hidden and text fields after a post that didn’t work as expected
as in a typical &lt;em&gt;MVC View Page&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The situation:&lt;/strong&gt; I have a page that needs to be called as a popup from
many pages in my MVC application. The page allows single or multiple selection of
“items” driven by an XML file. In the event that one day, almost always immediately,
I have two or more of these “controls” on one view page, I need the two fields and
the three JavaScript functions to have unique names so they don’t cross paths and
cause unexpected behavior. I had an &lt;em&gt;ASP.NET User Control&lt;/em&gt; to do this in plain
old ASP.NET (POAN) since v1.1, and I can’t live without it. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The confusion:&lt;/strong&gt; If I were to place the hidden, textbox, anchors, and
JavaScript functions directly in the calling page, something magical happens after
a post. If the controls had values before the post, they appear to magically retain
there values after the post. It wasn’t until a colleague of mine, Sat, and I dug into
Reflector for a while did we realize what was happening. Html.TextBox, Html.Hidden,
and others all do something similar to auto-magically re-populate their values after
the post. Since I’m writing out my fields as &amp;lt;input type=”hidden”/&amp;gt; and &amp;lt;input
type=”text”/&amp;gt;, the magic doesn’t happen.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOTE: The magic will also not happen if you just
write &amp;lt;input type=”text”/&amp;gt; on the page. It only happens if you use Html.TextBox.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The solution:&lt;/strong&gt; I am still new to MVC and still trying to wrap my head
around the “right way” to do things. Reflector showed that the &lt;em&gt;HtmlHelpers&lt;/em&gt; all
looked at the ModelState in the ViewData before rendering their HTML. They looked
for their value by key (key being the control/tag name), and, if present, used that
as the control/tag’s value. Bing! Maybe I should do the same thing. So just before
I go to town with TagBuilder to assemble my controls/tags, I look in the ViewData’s
ModelState for my value. If it is there, it must have been posted there by me (my
control).
&lt;/p&gt;
&lt;div style="width: 650px; font-family: consolas; background: #3f3f3f; color: #dcdccc; font-size: 9pt"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 48&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;UrlHelper&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;urlHelper&lt;/span&gt; = &lt;span style="color: #e1e18a; font-weight: bold"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;UrlHelper&lt;/span&gt;(&lt;span style="color: #dfdfbf"&gt;helper&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;ViewContext&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;RequestContext&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 49&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #e1e18a; font-weight: bold"&gt;string&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;textValue&lt;/span&gt; = &lt;span style="color: #e1e18a; font-weight: bold"&gt;null&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 50&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;ModelState&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;state&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 51&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 52&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #e1e18a; font-weight: bold"&gt;if&lt;/span&gt; (&lt;span style="color: #dfdfbf"&gt;helper&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;ViewData&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;ModelState&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;TryGetValue&lt;/span&gt;(&lt;span style="color: #dfdfbf"&gt;textFieldName&lt;/span&gt;, &lt;span style="color: #e1e18a; font-weight: bold"&gt;out&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;state&lt;/span&gt;))
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 53&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 54&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #dfdfbf"&gt;textValue&lt;/span&gt; = &lt;span style="color: #dfdfbf"&gt;state&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;Value&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;AttemptedValue&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 55&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;p&gt;
Works like a charm! Now my hidden, textbox, two anchors, and three JavaScript functions
are bundled nicely inside of an &lt;em&gt;HtmlHelper&lt;/em&gt; class that looks and feels like
I’m using a built-in ASP.NET MVC &lt;em&gt;HtmlHelper&lt;/em&gt; class. Most importantly, I have
the pleasure of typing only this on all my consuming pages.
&lt;/p&gt;
&lt;div style="width: 650px; font-family: consolas; background: #3f3f3f; color: #dcdccc; font-size: 9pt"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 40&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: #ffee62; color: #000"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Html&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;MySelector&lt;/span&gt;(&lt;span style="color: #c89191"&gt;"selectedIDs"&lt;/span&gt;, &lt;span style="color: #c89191"&gt;"selectedNames"&lt;/span&gt;, &lt;span style="color: #c89191"&gt;"State"&lt;/span&gt;)&lt;span style="background: #ffee62; color: #000"&gt;%&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=5d833e28-847b-41a8-905f-549b0f6c1f84" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,5d833e28-847b-41a8-905f-549b0f6c1f84.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
      <category>C#</category>
      <category>Javascript</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=3331f559-3440-430f-a4c0-f18f5e90346f</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,3331f559-3440-430f-a4c0-f18f5e90346f.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,3331f559-3440-430f-a4c0-f18f5e90346f.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3331f559-3440-430f-a4c0-f18f5e90346f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been talking about Geneva for a long time. I got the basics down earlier in the
year. I tried to come up with my own set of sample apps, but failed to get anywhere.
With the official release, and renaming to <em>Windows Identity Foundation (WIF)</em>,
I have renewed inspiration.
</p>
        <p>
I read Michele Leroux Bustamante’s MSDN magazine article, <a href="http://msdn.microsoft.com/en-us/magazine/ee335707.aspx" target="_blank">Claim-Based
Authorization with WIF</a>, last night. After reading the article, I was confident
that I could get a claims-aware WCF service stood up with a custom STS in a matter
of hours. Today I downloaded and installed WIF. I also installed the WIF SDK and all
of the prerequisite hotfixes. I perused the readme files and looked through some of
the samples code. Everything is layed out sensibly, the samples are commented sufficiently,
and the samples include setup and cleanup batch scripts when necessary.
</p>
        <p>
The samples include:
</p>
        <blockquote>
          <p>
Quick Start
</p>
          <ol>
            <li>
Simple Claims Aware Web Application 
</li>
            <li>
Simple Claims Aware Web Service 
</li>
            <li>
Simple Web Application With Information Card SignIn 
</li>
            <li>
Simple Web Application With Managed STS 
</li>
            <li>
Claims Aware Web Application in a Web Farm 
</li>
            <li>
Using Claims In IsInRole 
</li>
          </ol>
          <p>
End-to-end Scenario
</p>
          <ol>
            <li>
Authentication Assurance 
</li>
            <li>
Federation For Web Services 
</li>
            <li>
Federation For Web Applications 
</li>
            <li>
Identity Delegation 
</li>
            <li>
Web Application With Multiple SignIn Methods 
</li>
            <li>
Federation Metadata</li>
          </ol>
          <p>
Extensibility
</p>
          <ol>
            <li>
Claims Aware AJAX Application 
</li>
            <li>
Convert Claims To NT Token 
</li>
            <li>
Customizing Request Security Token 
</li>
            <li>
Customizing Token 
</li>
            <li>
WSTrustChannel 
</li>
            <li>
Claims-based Authorization</li>
          </ol>
        </blockquote>
        <p>
All of the samples I’ve run through so far are great. The only thing that I’m not
in love with is all the XML required to wire this stuff up. Maybe some Juval-style
extensions would make it less painful.
</p>
        <p>
One more thing… it looks like all of the XP users will finally have to upgrade. WIF
only works with Vista, Win7, and Win2008. I heard that Win2003 compatibility will
arrive in December.
</p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/evalcenter/dd440951.aspx" target="_blank">Download
Windows Identity Foundation</a>
        </p>
        <p>
          <a href="http://www.microsoft.com/downloads/info.aspx?na=47&amp;p=1&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;u=details.aspx%3ffamilyid%3dC148B2DF-C7AF-46BB-9162-2C9422208504%26displaylang%3den" target="_blank">Download
Windows Identity Foundation SDK</a>
        </p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=3331f559-3440-430f-a4c0-f18f5e90346f" />
      </body>
      <title>WIF FTW</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,3331f559-3440-430f-a4c0-f18f5e90346f.aspx</guid>
      <link>http://offroadcoder.com/2009/11/27/WIFFTW.aspx</link>
      <pubDate>Fri, 27 Nov 2009 04:44:24 GMT</pubDate>
      <description>&lt;p&gt;
I’ve been talking about Geneva for a long time. I got the basics down earlier in the
year. I tried to come up with my own set of sample apps, but failed to get anywhere.
With the official release, and renaming to &lt;em&gt;Windows Identity Foundation (WIF)&lt;/em&gt;,
I have renewed inspiration.
&lt;/p&gt;
&lt;p&gt;
I read Michele Leroux Bustamante’s MSDN magazine article, &lt;a href="http://msdn.microsoft.com/en-us/magazine/ee335707.aspx" target="_blank"&gt;Claim-Based
Authorization with WIF&lt;/a&gt;, last night. After reading the article, I was confident
that I could get a claims-aware WCF service stood up with a custom STS in a matter
of hours. Today I downloaded and installed WIF. I also installed the WIF SDK and all
of the prerequisite hotfixes. I perused the readme files and looked through some of
the samples code. Everything is layed out sensibly, the samples are commented sufficiently,
and the samples include setup and cleanup batch scripts when necessary.
&lt;/p&gt;
&lt;p&gt;
The samples include:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Quick Start
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Simple Claims Aware Web Application 
&lt;li&gt;
Simple Claims Aware Web Service 
&lt;li&gt;
Simple Web Application With Information Card SignIn 
&lt;li&gt;
Simple Web Application With Managed STS 
&lt;li&gt;
Claims Aware Web Application in a Web Farm 
&lt;li&gt;
Using Claims In IsInRole 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
End-to-end Scenario
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Authentication Assurance 
&lt;li&gt;
Federation For Web Services 
&lt;li&gt;
Federation For Web Applications 
&lt;li&gt;
Identity Delegation 
&lt;li&gt;
Web Application With Multiple SignIn Methods 
&lt;li&gt;
Federation Metadata&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Extensibility
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Claims Aware AJAX Application 
&lt;li&gt;
Convert Claims To NT Token 
&lt;li&gt;
Customizing Request Security Token 
&lt;li&gt;
Customizing Token 
&lt;li&gt;
WSTrustChannel 
&lt;li&gt;
Claims-based Authorization&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
All of the samples I’ve run through so far are great. The only thing that I’m not
in love with is all the XML required to wire this stuff up. Maybe some Juval-style
extensions would make it less painful.
&lt;/p&gt;
&lt;p&gt;
One more thing… it looks like all of the XP users will finally have to upgrade. WIF
only works with Vista, Win7, and Win2008. I heard that Win2003 compatibility will
arrive in December.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://msdn.microsoft.com/en-us/evalcenter/dd440951.aspx" target="_blank"&gt;Download
Windows Identity Foundation&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/info.aspx?na=47&amp;amp;p=1&amp;amp;SrcDisplayLang=en&amp;amp;SrcCategoryId=&amp;amp;SrcFamilyId=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;amp;u=details.aspx%3ffamilyid%3dC148B2DF-C7AF-46BB-9162-2C9422208504%26displaylang%3den" target="_blank"&gt;Download
Windows Identity Foundation SDK&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=3331f559-3440-430f-a4c0-f18f5e90346f" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,3331f559-3440-430f-a4c0-f18f5e90346f.aspx</comments>
      <category>.NET Framework</category>
      <category>AJAX</category>
      <category>ASP.NET</category>
      <category>C#</category>
      <category>WCF</category>
      <category>WIF</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=cfeeb9f7-2a9e-40a5-99ce-dea714e3284d</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,cfeeb9f7-2a9e-40a5-99ce-dea714e3284d.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,cfeeb9f7-2a9e-40a5-99ce-dea714e3284d.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=cfeeb9f7-2a9e-40a5-99ce-dea714e3284d</wfw:commentRss>
      <slash:comments>9</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
WCF never ceases to amaze me. Around every corner is another fascinating use for WCF,
and much forethought on Microsoft's part to make it look and behave great. I wanted
to expose my services to my AJAX functions on my web site. I did not want to change
my class library because it is used by other clients. I could just add the service
classes to this web site, but why re-do when you can re-use.
</p>
        <p>
If you have an existing WCF Service Library, you will need to expose it with the <font color="#0000ff">AspNetCompatibilityRequirementsMode</font>.Allowed
attribute on the service class to make it visible to ASP.NET clients. To avoid changing
your service library in any way, the easiest thing to do is to add a new class to
your web site that inherits from your service class. In this example, my existing
service library uses the <em>JeepServices</em> namespace. Notice there is no implementation
in this class. It is simply a placeholder for the real service implementation with
the compatibility attribute attached.
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red225\green225\blue138;\red63\green63\blue63;\red220\green220\blue204;\red223\green223\blue191;\red43\green145\blue175;}??\fs18 \cf1\cb2\highlight2 {\b using}\cf3  \cf4 System\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 Linq\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 Runtime\cf3 .\cf4 Serialization\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 .\cf4 Activation\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 .\cf4 Web\cf3 ;\par ??\par ??[\cf5 ServiceBehavior\cf3 (\cf4 IncludeExceptionDetailInFaults\cf3  = \cf1 {\b true}\cf3 )]\par ??[\cf5 AspNetCompatibilityRequirements\cf3 (\cf4 RequirementsMode\cf3  = \cf5 AspNetCompatibilityRequirementsMode\cf3 .\cf4 Allowed\cf3 )]\par ??\cf1 {\b public}\cf3  \cf1 {\b class}\cf3  \cf5 WebHttpService\cf3  : \cf4 JeepServices\cf3 .\cf5 Service\par ??\cf3 \{\par ??\}}
-->
        </p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red225\green225\blue138;\red63\green63\blue63;\red220\green220\blue204;\red223\green223\blue191;\red43\green145\blue175;}??\fs18 \cf1\cb2\highlight2 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 .\cf4 Activation\cf3 ;\par ??\par ??[\cf5 ServiceBehavior\cf3 (\cf4 IncludeExceptionDetailInFaults\cf3  = \cf1 {\b true}\cf3 )]\par ??[\cf5 AspNetCompatibilityRequirements\cf3 (\cf4 RequirementsMode\cf3  = \cf5 AspNetCompatibilityRequirementsMode\cf3 .\cf4 Allowed\cf3 )]\par ??\cf1 {\b public}\cf3  \cf1 {\b class}\cf3  \cf5 WebHttpService\cf3  : \cf4 JeepServices\cf3 .\cf5 Service\par ??\cf3 \{\par ??\}}
-->
        </p>
        <div style="font-size: 9pt; background: #3f3f3f; width: 817px; color: #dcdccc; font-family: consolas; height: 126px">
          <p style="margin: 0px">
            <span style="color: #85ac8d">    1</span> <span style="font-weight: bold; color: #e1e18a">using</span><span style="color: #dfdfbf">System</span>.<span style="color: #dfdfbf">ServiceModel</span>;
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    2</span> <span style="font-weight: bold; color: #e1e18a">using</span><span style="color: #dfdfbf">System</span>.<span style="color: #dfdfbf">ServiceModel</span>.<span style="color: #dfdfbf">Activation</span>;
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    3</span> 
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    4</span> [<span style="color: #2b91af">ServiceBehavior</span>]
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    5</span> [<span style="color: #2b91af">AspNetCompatibilityRequirements</span>(<span style="color: #dfdfbf">RequirementsMode</span> = <span style="color: #2b91af">AspNetCompatibilityRequirementsMode</span>.<span style="color: #dfdfbf">Allowed</span>)]
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    6</span> <span style="font-weight: bold; color: #e1e18a">public</span><span style="font-weight: bold; color: #e1e18a">class</span><span style="color: #2b91af">WebHttpService</span> : <span style="color: #dfdfbf">JeepServices</span>.<span style="color: #2b91af">Service</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    7</span> {
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    8</span> }
</p>
        </div>
        <p>
        </p>
        <p>
Now that I have a ASP.NET compatible service, I need to expose it to the web site
clients. Create a service file (.svc), and change the <em>Service</em> and <em>CodeBehind</em> attributes
to point to the .svc file. The last thing you need is the <em>Factory</em> attribute.
This notifies WCF of this service, eliminating the need for a configuration file entry
for the service endpoint. In fact, you don't even need the &lt;system.servicemodel&gt;
in your configuration file at all. This is because it is only hosted as a web script,
and cannot be called outside of the web site.
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green238\blue98;\red239\green239\blue143;\red63\green63\blue63;\red220\green220\blue204;\red227\green206\blue171;\red223\green223\blue191;\red204\green147\blue147;}??\fs18 \cb2\highlight2 &lt;%\cf3\cb4\highlight4 @\cf5  \cf6 ServiceHost\cf5  \cf7 Language\cf3 =\cf8 "C#"\cf5  \cf7 Debug\cf3 =\cf8 "true"\cf5  \cf7 Service\cf3 =\cf8 "WebHttpService"\cf5  \cf7 CodeBehind\cf3 =\cf8 "~/App_Code/WebHttpService.cs"\par ??\cf5 \tab \cf7 Factory\cf3 =\cf8 "System.ServiceModel.Activation.WebScriptServiceHostFactory"\cf5  \cf0\cb2\highlight2 %&gt;}
-->
        </p>
        <div style="font-size: 9pt; background: #3f3f3f; width: 816px; color: #dcdccc; font-family: consolas; height: 43px">
          <p style="margin: 0px">
            <span style="color: #85ac8d">    1</span> <span style="background: #ffee62">&lt;%</span><span style="color: #efef8f">@</span><span style="color: #e3ceab">ServiceHost</span><span style="color: #dfdfbf">Language</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"C#"</span><span style="color: #dfdfbf">Debug</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"true"</span><span style="color: #dfdfbf">Service</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"WebHttpService"</span><span style="color: #dfdfbf">CodeBehind</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"~/App_Code/WebHttpService.cs"</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    2</span>     <span style="color: #dfdfbf">Factory</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"System.ServiceModel.Activation.WebScriptServiceHostFactory"</span><span style="background: #ffee62">%&gt;</span></p>
        </div>
        <p>
 
</p>
        <p>
In your web page you will need a few things. First your will need a <em>ScriptManager</em> with
a <em>ServiceReference</em> to the .svc file. You will then need the Javascript functions
to make the call (<em>DoJeepWork</em>), handle the success message (<em>OnJeepWorkSucceeded</em>),
and handle the failure message (<em>OnJeepWorkFailed</em>). Notice in <em>DoJeepWork</em> that
you don't call the service by it's service name <em>WebHttpService</em>, you call
it by the ServiceContract namespace and name. For this example, my interface has ServiceContract
attributes Namespace = "JeepServices", and Name = "JeepServiceContract". Now you just
wire up a ASP.NET control's OnClientClick or an input or anchor tag's onclick to <em>DoJeepWork()</em> and
you are good to go.
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green238\blue98;\red239\green239\blue143;\red63\green63\blue63;\red220\green220\blue204;\red227\green206\blue171;\red223\green223\blue191;\red204\green147\blue147;\red225\green225\blue138;\red200\green145\blue145;\red127\green159\blue127;}??\fs18 \cb2\highlight2 &lt;%\cf3\cb4\highlight4 @\cf5  \cf6 Page\cf5  \cf7 Language\cf3 =\cf8 "C#"\cf5  \cf7 AutoEventWireup\cf3 =\cf8 "true"\cf5  \cf7 CodeFile\cf3 =\cf8 "Default.aspx.cs"\cf5  \cf7 Inherits\cf3 =\cf8 "_Default"\cf5  \cf0\cb2\highlight2 %&gt;\par ??\par ??\cf3\cb4\highlight4 &lt;!\cf6 DOCTYPE\cf5  \cf7 html\cf5  \cf7 PUBLIC\cf5  \cf8 "-//W3C//DTD XHTML 1.0 Transitional//EN"\cf5  \cf8 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"\cf3 &gt;\par ??&lt;\cf6 html\cf5  \cf7 xmlns\cf3 =\cf8 "http://www.w3.org/1999/xhtml"\cf3 &gt;\par ??&lt;\cf6 head\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;\cf6 title\cf3 &gt;\cf5 Test page\cf3 &lt;/\cf6 title\cf3 &gt;\par ??\par ??\cf5 \tab \cf3 &lt;\cf6 script\cf5  \cf7 type\cf3 =\cf8 "text/javascript"\cf3 &gt;\par ??\cf5 \tab \tab \cf9 {\b function}\cf5  \cf7 DoJeepWork\cf5 ()\par ??\tab \tab \{    \par ??\tab \tab \tab \cf7 JeepServices\cf5 .\cf7 JeepServiceContract\cf5 .\cf7 DoWork\cf5 (\cf7 OnJeepWorkSuccedeed\cf5 , \cf7 OnJeepWorkFailed\cf5 );\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkSuccedeed\cf5 (\cf7 res\cf5 )\par ??\tab \tab \{\par ??\tab \tab \tab \cf7 document\cf5 .\cf7 getElementById\cf5 (\cf10 "&lt;%= this.lblMessage.ClientID %&gt;"\cf5 ).\cf7 innerText\cf5  = \cf7 res\cf5 ;\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkFailed\cf5 (\cf7 error\cf5 )\par ??\tab \tab \{\par ??\tab \tab     \cf11 // Alert user to the error.    \par ??\cf5 \tab \tab     \cf7 alert\cf5 (\cf7 error\cf5 .\cf7 get_message\cf5 ());\par ??\tab \tab \}\par ??\tab \cf3 &lt;/\cf6 script\cf3 &gt;\par ??\par ??&lt;/\cf6 head\cf3 &gt;\par ??&lt;\cf6 body\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;\cf6 form\cf5  \cf7 id\cf3 =\cf8 "form1"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;\cf6 div\cf3 &gt;\par ??\cf5 \tab \tab \cf3 &lt;\cf6 asp\cf3 :\cf6 ScriptManager\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &gt;\par ??\cf5 \tab \tab \tab \cf3 &lt;\cf6 Services\cf3 &gt;\par ??\cf5 \tab \tab \tab \tab \cf3 &lt;\cf6 asp\cf3 :\cf6 ServiceReference\cf5  \cf7 Path\cf3 =\cf8 "~/Services/WebHttpService.svc"\cf5  \cf7 InlineScript\cf3 =\cf8 "false"\cf5  \cf3 /&gt;\par ??\cf5 \tab \tab \tab \cf3 &lt;/\cf6 Services\cf3 &gt;\par ??\cf5 \tab \tab \cf3 &lt;/\cf6 asp\cf3 :\cf6 ScriptManager\cf3 &gt;\par ??\cf5 \tab \tab \cf3 &lt;\cf6 asp\cf3 :\cf6 Label\cf5  \cf7 ID\cf3 =\cf8 "lblMessage"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf5  \cf7 Text\cf3 =\cf8 "No work has been done"\cf5  \cf3 /&gt;\cf5  \cf3 &lt;\cf6 a\cf5  \cf7 href\cf3 =\cf8 "javascript:void(0); DoJeepWork()"\cf3 &gt;\cf5 Do Work\cf3 &lt;/\cf6 a\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;/\cf6 div\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;/\cf6 form\cf3 &gt;\par ??&lt;/\cf6 body\cf3 &gt;\par ??&lt;/\cf6 html\cf3 &gt;}
-->
        </p>
        <p>
        </p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green238\blue98;\red239\green239\blue143;\red63\green63\blue63;\red220\green220\blue204;\red227\green206\blue171;\red223\green223\blue191;\red204\green147\blue147;\red225\green225\blue138;\red200\green145\blue145;\red127\green159\blue127;}??\fs18 \cb2\highlight2 &lt;%\cf3\cb4\highlight4 @\cf5  \cf6 Page\cf5  \cf7 Language\cf3 =\cf8 "C#"\cf5  \cf7 AutoEventWireup\cf3 =\cf8 "true"\cf5  \cf7 CodeFile\cf3 =\cf8 "Default.aspx.cs"\cf5  \cf7 Inherits\cf3 =\cf8 "_Default"\cf5  \cf0\cb2\highlight2 %&gt;\par ??\par ??\cf3\cb4\highlight4 &lt;!\cf6 DOCTYPE\cf5  \cf7 html\cf5  \cf7 PUBLIC\cf5  \cf8 "-//W3C//DTD XHTML 1.0 Transitional//EN"\par ??"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"\cf3 &gt;\par ??&lt;\cf6 html\cf5  \cf7 xmlns\cf3 =\cf8 "http://www.w3.org/1999/xhtml"\cf3 &gt;\par ??&lt;\cf6 head\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;\cf6 title\cf3 &gt;\cf5 Test page\cf3 &lt;/\cf6 title\cf3 &gt;\par ??\par ??\cf5 \tab \cf3 &lt;\cf6 script\cf5  \cf7 type\cf3 =\cf8 "text/javascript"\cf3 &gt;\par ??\cf5 \tab \tab \cf9 {\b function}\cf5  \cf7 DoJeepWork\cf5 () \{\par ??\tab \tab \tab \cf7 JeepServices\cf5 .\cf7 JeepServiceContract\cf5 .\cf7 DoWork\cf5 (\cf7 OnJeepWorkSuccedeed\cf5 , \cf7 OnJeepWorkFailed\cf5 );\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkSuccedeed\cf5 (\cf7 res\cf5 ) \{\par ??\tab \tab \tab \cf7 document\cf5 .\cf7 getElementById\cf5 (\cf10 "&lt;%= this.lblMessage.ClientID %&gt;"\cf5 ).\cf7 innerText\cf5  = \cf7 res\cf5 ;\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkFailed\cf5 (\cf7 error\cf5 ) \{\par ??\tab \tab \tab \cf11 // Alert user to the error.    \par ??\cf5 \tab \tab \tab \cf7 alert\cf5 (\cf7 error\cf5 .\cf7 get_message\cf5 ());\par ??\tab \tab \}\par ??\tab \cf3 &lt;/\cf6 script\cf3 &gt;\par ??\par ??&lt;/\cf6 head\cf3 &gt;\par ??&lt;\cf6 body\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;\cf6 form\cf5  \cf7 id\cf3 =\cf8 "form1"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;\cf6 div\cf3 &gt;\par ??\cf5 \tab \tab \cf3 &lt;\cf6 asp\cf3 :\cf6 ScriptManager\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &gt;\par ??\cf5 \tab \tab \tab \cf3 &lt;\cf6 Services\cf3 &gt;\par ??\cf5 \tab \tab \tab \tab \cf3 &lt;\cf6 asp\cf3 :\cf6 ServiceReference\cf5  \cf7 Path\cf3 =\cf8 "~/Services/WebHttpService.svc"\cf5  \cf7 InlineScript\cf3 =\cf8 "false"\cf5  \cf3 /&gt;\par ??\cf5 \tab \tab \tab \cf3 &lt;/\cf6 Services\cf3 &gt;\par ??\cf5 \tab \tab \cf3 &lt;/\cf6 asp\cf3 :\cf6 ScriptManager\cf3 &gt;\par ??\cf5 \tab \tab \cf3 &lt;\cf6 asp\cf3 :\cf6 Label\cf5  \cf7 ID\cf3 =\cf8 "lblMessage"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf5  \cf7 Text\cf3 =\cf8 "No work has been done"\cf5  \cf3 /&gt;\par ??\cf5 \tab \tab \cf3 &lt;\cf6 a\cf5  \cf7 href\cf3 =\cf8 "javascript:void(0); DoJeepWork()"\cf3 &gt;\cf5 Do Work\cf3 &lt;/\cf6 a\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;/\cf6 div\cf3 &gt;\par ??\cf5 \tab \cf3 &lt;/\cf6 form\cf3 &gt;\par ??&lt;/\cf6 body\cf3 &gt;\par ??&lt;/\cf6 html\cf3 &gt;\par ??}
-->
        </p>
        <div style="font-size: 9pt; background: #3f3f3f; width: 819px; color: #dcdccc; font-family: consolas; height: 519px">
          <p style="margin: 0px">
            <span style="color: #85ac8d">    1</span> <span style="background: #ffee62">&lt;%</span><span style="color: #efef8f">@</span><span style="color: #e3ceab">Page</span><span style="color: #dfdfbf">Language</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"C#"</span><span style="color: #dfdfbf">AutoEventWireup</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"true"</span><span style="color: #dfdfbf">CodeFile</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"Default.aspx.cs"</span><span style="color: #dfdfbf">Inherits</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"_Default"</span><span style="background: #ffee62">%&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    2</span> 
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    3</span> <span style="color: #efef8f">&lt;!</span><span style="color: #e3ceab">DOCTYPE</span><span style="color: #dfdfbf">html</span><span style="color: #dfdfbf">PUBLIC</span><span style="color: #cc9393">"-//W3C//DTD
XHTML 1.0 Transitional//EN"</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    4</span> <span style="color: #cc9393">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    5</span> <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">html</span><span style="color: #dfdfbf">xmlns</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"http://www.w3.org/1999/xhtml"</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    6</span> <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">head</span><span style="color: #dfdfbf">runat</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"server"</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    7</span>     <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">title</span><span style="color: #efef8f">&gt;</span>Test
page<span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">title</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    8</span> 
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">    9</span>     <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">script</span><span style="color: #dfdfbf">type</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"text/javascript"</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   10</span>         <span style="font-weight: bold; color: #e1e18a">function</span><span style="color: #dfdfbf">DoJeepWork</span>()
{
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   11</span>             <span style="color: #dfdfbf">JeepServices</span>.<span style="color: #dfdfbf">JeepServiceContract</span>.<span style="color: #dfdfbf">DoWork</span>(<span style="color: #dfdfbf">OnJeepWorkSuccedeed</span>, <span style="color: #dfdfbf">OnJeepWorkFailed</span>);
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   12</span>        
}
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   13</span>         <span style="font-weight: bold; color: #e1e18a">function</span><span style="color: #dfdfbf">OnJeepWorkSuccedeed</span>(<span style="color: #dfdfbf">res</span>)
{
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   14</span>             <span style="color: #dfdfbf">document</span>.<span style="color: #dfdfbf">getElementById</span>(<span style="color: #c89191">"&lt;%=
this.lblMessage.ClientID %&gt;"</span>).<span style="color: #dfdfbf">innerText</span> = <span style="color: #dfdfbf">res</span>;
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   15</span>        
}
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   16</span>         <span style="font-weight: bold; color: #e1e18a">function</span><span style="color: #dfdfbf">OnJeepWorkFailed</span>(<span style="color: #dfdfbf">error</span>)
{
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   17</span>             <span style="color: #7f9f7f">//
Alert user to the error.    </span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   18</span>             <span style="color: #dfdfbf">alert</span>(<span style="color: #dfdfbf">error</span>.<span style="color: #dfdfbf">get_message</span>());
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   19</span>        
}
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   20</span>     <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">script</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   21</span> 
</p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   22</span> <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">head</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   23</span> <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">body</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   24</span>     <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">form</span><span style="color: #dfdfbf">id</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"form1"</span><span style="color: #dfdfbf">runat</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"server"</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   25</span>     <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">div</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   26</span>         <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">asp</span><span style="color: #efef8f">:</span><span style="color: #e3ceab">ScriptManager</span><span style="color: #dfdfbf">runat</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"server"</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   27</span>             <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">Services</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   28</span>                 <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">asp</span><span style="color: #efef8f">:</span><span style="color: #e3ceab">ServiceReference</span><span style="color: #dfdfbf">Path</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"~/Services/WebHttpService.svc"</span><span style="color: #dfdfbf">InlineScript</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"false"</span><span style="color: #efef8f">/&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   29</span>             <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">Services</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   30</span>         <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">asp</span><span style="color: #efef8f">:</span><span style="color: #e3ceab">ScriptManager</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   31</span>         <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">asp</span><span style="color: #efef8f">:</span><span style="color: #e3ceab">Label</span><span style="color: #dfdfbf">ID</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"lblMessage"</span><span style="color: #dfdfbf">runat</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"server"</span><span style="color: #dfdfbf">Text</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"No
work has been done"</span><span style="color: #efef8f">/&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   32</span>         <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">a</span><span style="color: #dfdfbf">href</span><span style="color: #efef8f">=</span><span style="color: #cc9393">"javascript:void(0);
DoJeepWork()"</span><span style="color: #efef8f">&gt;</span>Do Work<span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">a</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   33</span>     <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">div</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   34</span>     <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">form</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   35</span> <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">body</span><span style="color: #efef8f">&gt;</span></p>
          <p style="margin: 0px">
            <span style="color: #85ac8d">   36</span> <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">html</span><span style="color: #efef8f">&gt;</span></p>
        </div>
        <p>
 
</p>
        <p>
Mission accomplished! Here you've seen how to expose an existing WCF service library
without changing any code in the library itself. Adding two files allowed the service
to be exposed to your AJAX clients. Best of all, there is no configuration file changes
to make.
</p>
        <p>
        </p>
        <p>
Useful Links:
</p>
        <ul>
          <li>
            <a href="http://msdn.microsoft.com/en-us/library/bb514961.aspx">Exposing WCF Services
to Client Script</a>
          </li>
        </ul>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=cfeeb9f7-2a9e-40a5-99ce-dea714e3284d" />
      </body>
      <title>Exposing existing WCF services to ASP.NET AJAX clients</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,cfeeb9f7-2a9e-40a5-99ce-dea714e3284d.aspx</guid>
      <link>http://offroadcoder.com/2008/09/21/ExposingExistingWCFServicesToASPNETAJAXClients.aspx</link>
      <pubDate>Sun, 21 Sep 2008 16:21:24 GMT</pubDate>
      <description>&lt;p&gt;
WCF never ceases to amaze me. Around every corner is another fascinating use for WCF,
and much forethought on Microsoft's part to make it look and behave great. I wanted
to expose my services to my AJAX functions on my web site. I did not want to change
my class library because it is used by other clients. I could just add the service
classes to this web site, but why re-do when you can re-use.
&lt;/p&gt;
&lt;p&gt;
If you have an existing WCF Service Library, you will need to expose it with the &lt;font color="#0000ff"&gt;AspNetCompatibilityRequirementsMode&lt;/font&gt;.Allowed
attribute on the service class to make it visible to ASP.NET clients. To avoid changing
your service library in any way, the easiest thing to do is to add a new class to
your web site that inherits from your service class. In this example, my existing
service library uses the &lt;em&gt;JeepServices&lt;/em&gt; namespace. Notice there is no implementation
in this class. It is simply a placeholder for the real service implementation with
the compatibility attribute attached.
&lt;/p&gt;
&lt;p&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red225\green225\blue138;\red63\green63\blue63;\red220\green220\blue204;\red223\green223\blue191;\red43\green145\blue175;}??\fs18 \cf1\cb2\highlight2 {\b using}\cf3  \cf4 System\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 Linq\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 Runtime\cf3 .\cf4 Serialization\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 .\cf4 Activation\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 .\cf4 Web\cf3 ;\par ??\par ??[\cf5 ServiceBehavior\cf3 (\cf4 IncludeExceptionDetailInFaults\cf3  = \cf1 {\b true}\cf3 )]\par ??[\cf5 AspNetCompatibilityRequirements\cf3 (\cf4 RequirementsMode\cf3  = \cf5 AspNetCompatibilityRequirementsMode\cf3 .\cf4 Allowed\cf3 )]\par ??\cf1 {\b public}\cf3  \cf1 {\b class}\cf3  \cf5 WebHttpService\cf3  : \cf4 JeepServices\cf3 .\cf5 Service\par ??\cf3 \{\par ??\}}
--&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red225\green225\blue138;\red63\green63\blue63;\red220\green220\blue204;\red223\green223\blue191;\red43\green145\blue175;}??\fs18 \cf1\cb2\highlight2 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 ;\par ??\cf1 {\b using}\cf3  \cf4 System\cf3 .\cf4 ServiceModel\cf3 .\cf4 Activation\cf3 ;\par ??\par ??[\cf5 ServiceBehavior\cf3 (\cf4 IncludeExceptionDetailInFaults\cf3  = \cf1 {\b true}\cf3 )]\par ??[\cf5 AspNetCompatibilityRequirements\cf3 (\cf4 RequirementsMode\cf3  = \cf5 AspNetCompatibilityRequirementsMode\cf3 .\cf4 Allowed\cf3 )]\par ??\cf1 {\b public}\cf3  \cf1 {\b class}\cf3  \cf5 WebHttpService\cf3  : \cf4 JeepServices\cf3 .\cf5 Service\par ??\cf3 \{\par ??\}}
--&gt;
&lt;/p&gt;
&lt;div style="font-size: 9pt; background: #3f3f3f; width: 817px; color: #dcdccc; font-family: consolas; height: 126px"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/span&gt;&amp;nbsp;&lt;span style="font-weight: bold; color: #e1e18a"&gt;using&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;System&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;ServiceModel&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/span&gt;&amp;nbsp;&lt;span style="font-weight: bold; color: #e1e18a"&gt;using&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;System&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;ServiceModel&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;Activation&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/span&gt; [&lt;span style="color: #2b91af"&gt;ServiceBehavior&lt;/span&gt;]
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/span&gt; [&lt;span style="color: #2b91af"&gt;AspNetCompatibilityRequirements&lt;/span&gt;(&lt;span style="color: #dfdfbf"&gt;RequirementsMode&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;AspNetCompatibilityRequirementsMode&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;Allowed&lt;/span&gt;)]
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/span&gt;&amp;nbsp;&lt;span style="font-weight: bold; color: #e1e18a"&gt;public&lt;/span&gt; &lt;span style="font-weight: bold; color: #e1e18a"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WebHttpService&lt;/span&gt; : &lt;span style="color: #dfdfbf"&gt;JeepServices&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;Service&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/span&gt; {
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/span&gt; }
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Now that I have a ASP.NET compatible service, I need to expose it to the web site
clients. Create a service file (.svc), and change the &lt;em&gt;Service&lt;/em&gt; and &lt;em&gt;CodeBehind&lt;/em&gt; attributes
to point to the .svc file. The last thing you need is the &lt;em&gt;Factory&lt;/em&gt; attribute.
This notifies WCF of this service, eliminating the need for a configuration file entry
for the service endpoint. In fact, you don't even need the &amp;lt;system.servicemodel&amp;gt;
in your configuration file at all. This is because it is only hosted as a web script,
and cannot be called outside of the web site.
&lt;/p&gt;
&lt;p&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green238\blue98;\red239\green239\blue143;\red63\green63\blue63;\red220\green220\blue204;\red227\green206\blue171;\red223\green223\blue191;\red204\green147\blue147;}??\fs18 \cb2\highlight2 &amp;lt;%\cf3\cb4\highlight4 @\cf5  \cf6 ServiceHost\cf5  \cf7 Language\cf3 =\cf8 "C#"\cf5  \cf7 Debug\cf3 =\cf8 "true"\cf5  \cf7 Service\cf3 =\cf8 "WebHttpService"\cf5  \cf7 CodeBehind\cf3 =\cf8 "~/App_Code/WebHttpService.cs"\par ??\cf5 \tab \cf7 Factory\cf3 =\cf8 "System.ServiceModel.Activation.WebScriptServiceHostFactory"\cf5  \cf0\cb2\highlight2 %&amp;gt;}
--&gt;
&lt;/p&gt;
&lt;div style="font-size: 9pt; background: #3f3f3f; width: 816px; color: #dcdccc; font-family: consolas; height: 43px"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/span&gt;&amp;nbsp;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: #efef8f"&gt;@&lt;/span&gt; &lt;span style="color: #e3ceab"&gt;ServiceHost&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Language&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"C#"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Debug&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"true"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Service&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"WebHttpService"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;CodeBehind&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"~/App_Code/WebHttpService.cs"&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #dfdfbf"&gt;Factory&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"System.ServiceModel.Activation.WebScriptServiceHostFactory"&lt;/span&gt; &lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
In your web page you will need a few things. First your will need a &lt;em&gt;ScriptManager&lt;/em&gt; with
a &lt;em&gt;ServiceReference&lt;/em&gt; to the .svc file. You will then need the Javascript functions
to make the call (&lt;em&gt;DoJeepWork&lt;/em&gt;), handle the success message (&lt;em&gt;OnJeepWorkSucceeded&lt;/em&gt;),
and handle the failure message (&lt;em&gt;OnJeepWorkFailed&lt;/em&gt;). Notice in &lt;em&gt;DoJeepWork&lt;/em&gt; that
you don't call the service by it's service name &lt;em&gt;WebHttpService&lt;/em&gt;, you call
it by the ServiceContract namespace and name. For this example, my interface has ServiceContract
attributes Namespace = "JeepServices", and Name = "JeepServiceContract". Now you just
wire up a ASP.NET control's OnClientClick or an input or anchor tag's onclick to &lt;em&gt;DoJeepWork()&lt;/em&gt; and
you are good to go.
&lt;/p&gt;
&lt;p&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green238\blue98;\red239\green239\blue143;\red63\green63\blue63;\red220\green220\blue204;\red227\green206\blue171;\red223\green223\blue191;\red204\green147\blue147;\red225\green225\blue138;\red200\green145\blue145;\red127\green159\blue127;}??\fs18 \cb2\highlight2 &amp;lt;%\cf3\cb4\highlight4 @\cf5  \cf6 Page\cf5  \cf7 Language\cf3 =\cf8 "C#"\cf5  \cf7 AutoEventWireup\cf3 =\cf8 "true"\cf5  \cf7 CodeFile\cf3 =\cf8 "Default.aspx.cs"\cf5  \cf7 Inherits\cf3 =\cf8 "_Default"\cf5  \cf0\cb2\highlight2 %&amp;gt;\par ??\par ??\cf3\cb4\highlight4 &amp;lt;!\cf6 DOCTYPE\cf5  \cf7 html\cf5  \cf7 PUBLIC\cf5  \cf8 "-//W3C//DTD XHTML 1.0 Transitional//EN"\cf5  \cf8 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"\cf3 &amp;gt;\par ??&amp;lt;\cf6 html\cf5  \cf7 xmlns\cf3 =\cf8 "http://www.w3.org/1999/xhtml"\cf3 &amp;gt;\par ??&amp;lt;\cf6 head\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;\cf6 title\cf3 &amp;gt;\cf5 Test page\cf3 &amp;lt;/\cf6 title\cf3 &amp;gt;\par ??\par ??\cf5 \tab \cf3 &amp;lt;\cf6 script\cf5  \cf7 type\cf3 =\cf8 "text/javascript"\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf9 {\b function}\cf5  \cf7 DoJeepWork\cf5 ()\par ??\tab \tab \{    \par ??\tab \tab \tab \cf7 JeepServices\cf5 .\cf7 JeepServiceContract\cf5 .\cf7 DoWork\cf5 (\cf7 OnJeepWorkSuccedeed\cf5 , \cf7 OnJeepWorkFailed\cf5 );\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkSuccedeed\cf5 (\cf7 res\cf5 )\par ??\tab \tab \{\par ??\tab \tab \tab \cf7 document\cf5 .\cf7 getElementById\cf5 (\cf10 "&amp;lt;%= this.lblMessage.ClientID %&amp;gt;"\cf5 ).\cf7 innerText\cf5  = \cf7 res\cf5 ;\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkFailed\cf5 (\cf7 error\cf5 )\par ??\tab \tab \{\par ??\tab \tab     \cf11 // Alert user to the error.    \par ??\cf5 \tab \tab     \cf7 alert\cf5 (\cf7 error\cf5 .\cf7 get_message\cf5 ());\par ??\tab \tab \}\par ??\tab \cf3 &amp;lt;/\cf6 script\cf3 &amp;gt;\par ??\par ??&amp;lt;/\cf6 head\cf3 &amp;gt;\par ??&amp;lt;\cf6 body\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;\cf6 form\cf5  \cf7 id\cf3 =\cf8 "form1"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;\cf6 div\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf3 &amp;lt;\cf6 asp\cf3 :\cf6 ScriptManager\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &amp;gt;\par ??\cf5 \tab \tab \tab \cf3 &amp;lt;\cf6 Services\cf3 &amp;gt;\par ??\cf5 \tab \tab \tab \tab \cf3 &amp;lt;\cf6 asp\cf3 :\cf6 ServiceReference\cf5  \cf7 Path\cf3 =\cf8 "~/Services/WebHttpService.svc"\cf5  \cf7 InlineScript\cf3 =\cf8 "false"\cf5  \cf3 /&amp;gt;\par ??\cf5 \tab \tab \tab \cf3 &amp;lt;/\cf6 Services\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf3 &amp;lt;/\cf6 asp\cf3 :\cf6 ScriptManager\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf3 &amp;lt;\cf6 asp\cf3 :\cf6 Label\cf5  \cf7 ID\cf3 =\cf8 "lblMessage"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf5  \cf7 Text\cf3 =\cf8 "No work has been done"\cf5  \cf3 /&amp;gt;\cf5  \cf3 &amp;lt;\cf6 a\cf5  \cf7 href\cf3 =\cf8 "javascript:void(0); DoJeepWork()"\cf3 &amp;gt;\cf5 Do Work\cf3 &amp;lt;/\cf6 a\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;/\cf6 div\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;/\cf6 form\cf3 &amp;gt;\par ??&amp;lt;/\cf6 body\cf3 &amp;gt;\par ??&amp;lt;/\cf6 html\cf3 &amp;gt;}
--&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green238\blue98;\red239\green239\blue143;\red63\green63\blue63;\red220\green220\blue204;\red227\green206\blue171;\red223\green223\blue191;\red204\green147\blue147;\red225\green225\blue138;\red200\green145\blue145;\red127\green159\blue127;}??\fs18 \cb2\highlight2 &amp;lt;%\cf3\cb4\highlight4 @\cf5  \cf6 Page\cf5  \cf7 Language\cf3 =\cf8 "C#"\cf5  \cf7 AutoEventWireup\cf3 =\cf8 "true"\cf5  \cf7 CodeFile\cf3 =\cf8 "Default.aspx.cs"\cf5  \cf7 Inherits\cf3 =\cf8 "_Default"\cf5  \cf0\cb2\highlight2 %&amp;gt;\par ??\par ??\cf3\cb4\highlight4 &amp;lt;!\cf6 DOCTYPE\cf5  \cf7 html\cf5  \cf7 PUBLIC\cf5  \cf8 "-//W3C//DTD XHTML 1.0 Transitional//EN"\par ??"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"\cf3 &amp;gt;\par ??&amp;lt;\cf6 html\cf5  \cf7 xmlns\cf3 =\cf8 "http://www.w3.org/1999/xhtml"\cf3 &amp;gt;\par ??&amp;lt;\cf6 head\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;\cf6 title\cf3 &amp;gt;\cf5 Test page\cf3 &amp;lt;/\cf6 title\cf3 &amp;gt;\par ??\par ??\cf5 \tab \cf3 &amp;lt;\cf6 script\cf5  \cf7 type\cf3 =\cf8 "text/javascript"\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf9 {\b function}\cf5  \cf7 DoJeepWork\cf5 () \{\par ??\tab \tab \tab \cf7 JeepServices\cf5 .\cf7 JeepServiceContract\cf5 .\cf7 DoWork\cf5 (\cf7 OnJeepWorkSuccedeed\cf5 , \cf7 OnJeepWorkFailed\cf5 );\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkSuccedeed\cf5 (\cf7 res\cf5 ) \{\par ??\tab \tab \tab \cf7 document\cf5 .\cf7 getElementById\cf5 (\cf10 "&amp;lt;%= this.lblMessage.ClientID %&amp;gt;"\cf5 ).\cf7 innerText\cf5  = \cf7 res\cf5 ;\par ??\tab \tab \}\par ??\tab \tab \cf9 {\b function}\cf5  \cf7 OnJeepWorkFailed\cf5 (\cf7 error\cf5 ) \{\par ??\tab \tab \tab \cf11 // Alert user to the error.    \par ??\cf5 \tab \tab \tab \cf7 alert\cf5 (\cf7 error\cf5 .\cf7 get_message\cf5 ());\par ??\tab \tab \}\par ??\tab \cf3 &amp;lt;/\cf6 script\cf3 &amp;gt;\par ??\par ??&amp;lt;/\cf6 head\cf3 &amp;gt;\par ??&amp;lt;\cf6 body\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;\cf6 form\cf5  \cf7 id\cf3 =\cf8 "form1"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;\cf6 div\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf3 &amp;lt;\cf6 asp\cf3 :\cf6 ScriptManager\cf5  \cf7 runat\cf3 =\cf8 "server"\cf3 &amp;gt;\par ??\cf5 \tab \tab \tab \cf3 &amp;lt;\cf6 Services\cf3 &amp;gt;\par ??\cf5 \tab \tab \tab \tab \cf3 &amp;lt;\cf6 asp\cf3 :\cf6 ServiceReference\cf5  \cf7 Path\cf3 =\cf8 "~/Services/WebHttpService.svc"\cf5  \cf7 InlineScript\cf3 =\cf8 "false"\cf5  \cf3 /&amp;gt;\par ??\cf5 \tab \tab \tab \cf3 &amp;lt;/\cf6 Services\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf3 &amp;lt;/\cf6 asp\cf3 :\cf6 ScriptManager\cf3 &amp;gt;\par ??\cf5 \tab \tab \cf3 &amp;lt;\cf6 asp\cf3 :\cf6 Label\cf5  \cf7 ID\cf3 =\cf8 "lblMessage"\cf5  \cf7 runat\cf3 =\cf8 "server"\cf5  \cf7 Text\cf3 =\cf8 "No work has been done"\cf5  \cf3 /&amp;gt;\par ??\cf5 \tab \tab \cf3 &amp;lt;\cf6 a\cf5  \cf7 href\cf3 =\cf8 "javascript:void(0); DoJeepWork()"\cf3 &amp;gt;\cf5 Do Work\cf3 &amp;lt;/\cf6 a\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;/\cf6 div\cf3 &amp;gt;\par ??\cf5 \tab \cf3 &amp;lt;/\cf6 form\cf3 &amp;gt;\par ??&amp;lt;/\cf6 body\cf3 &amp;gt;\par ??&amp;lt;/\cf6 html\cf3 &amp;gt;\par ??}
--&gt;
&lt;/p&gt;
&lt;div style="font-size: 9pt; background: #3f3f3f; width: 819px; color: #dcdccc; font-family: consolas; height: 519px"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/span&gt;&amp;nbsp;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: #efef8f"&gt;@&lt;/span&gt; &lt;span style="color: #e3ceab"&gt;Page&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Language&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"C#"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"true"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;CodeFile&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"Default.aspx.cs"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Inherits&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"_Default"&lt;/span&gt; &lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/span&gt;&amp;nbsp;&lt;span style="color: #efef8f"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;DOCTYPE&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;html&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #cc9393"&gt;"-//W3C//DTD
XHTML 1.0 Transitional//EN"&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/span&gt;&amp;nbsp;&lt;span style="color: #cc9393"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/span&gt;&amp;nbsp;&lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;html&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;xmlns&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/span&gt;&amp;nbsp;&lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;head&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;runat&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"server"&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;title&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;Test
page&lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;title&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;script&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;type&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"text/javascript"&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-weight: bold; color: #e1e18a"&gt;function&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;DoJeepWork&lt;/span&gt;()
{
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #dfdfbf"&gt;JeepServices&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;JeepServiceContract&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;DoWork&lt;/span&gt;(&lt;span style="color: #dfdfbf"&gt;OnJeepWorkSuccedeed&lt;/span&gt;, &lt;span style="color: #dfdfbf"&gt;OnJeepWorkFailed&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-weight: bold; color: #e1e18a"&gt;function&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;OnJeepWorkSuccedeed&lt;/span&gt;(&lt;span style="color: #dfdfbf"&gt;res&lt;/span&gt;)
{
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #dfdfbf"&gt;document&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;getElementById&lt;/span&gt;(&lt;span style="color: #c89191"&gt;"&amp;lt;%=
this.lblMessage.ClientID %&amp;gt;"&lt;/span&gt;).&lt;span style="color: #dfdfbf"&gt;innerText&lt;/span&gt; = &lt;span style="color: #dfdfbf"&gt;res&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-weight: bold; color: #e1e18a"&gt;function&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;OnJeepWorkFailed&lt;/span&gt;(&lt;span style="color: #dfdfbf"&gt;error&lt;/span&gt;)
{
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #7f9f7f"&gt;//
Alert user to the error.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 18&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #dfdfbf"&gt;alert&lt;/span&gt;(&lt;span style="color: #dfdfbf"&gt;error&lt;/span&gt;.&lt;span style="color: #dfdfbf"&gt;get_message&lt;/span&gt;());
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;script&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 21&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 22&lt;/span&gt;&amp;nbsp;&lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;head&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 23&lt;/span&gt;&amp;nbsp;&lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;body&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;form&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;id&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"form1"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;runat&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"server"&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;div&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;asp&lt;/span&gt;&lt;span style="color: #efef8f"&gt;:&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;ScriptManager&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;runat&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"server"&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 27&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;Services&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;asp&lt;/span&gt;&lt;span style="color: #efef8f"&gt;:&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;ServiceReference&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Path&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"~/Services/WebHttpService.svc"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;InlineScript&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"false"&lt;/span&gt; &lt;span style="color: #efef8f"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;Services&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;asp&lt;/span&gt;&lt;span style="color: #efef8f"&gt;:&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;ScriptManager&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;asp&lt;/span&gt;&lt;span style="color: #efef8f"&gt;:&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;Label&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;ID&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"lblMessage"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;runat&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"server"&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;Text&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"No
work has been done"&lt;/span&gt; &lt;span style="color: #efef8f"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 32&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;a&lt;/span&gt; &lt;span style="color: #dfdfbf"&gt;href&lt;/span&gt;&lt;span style="color: #efef8f"&gt;=&lt;/span&gt;&lt;span style="color: #cc9393"&gt;"javascript:void(0);
DoJeepWork()"&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;Do Work&lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;a&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 33&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;div&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 34&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;form&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 35&lt;/span&gt;&amp;nbsp;&lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;body&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #85ac8d"&gt;&amp;nbsp;&amp;nbsp; 36&lt;/span&gt;&amp;nbsp;&lt;span style="color: #efef8f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #e3ceab"&gt;html&lt;/span&gt;&lt;span style="color: #efef8f"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Mission accomplished! Here you've seen how to expose an existing WCF service library
without changing any code in the library itself. Adding two files allowed the service
to be exposed to your AJAX clients. Best of all, there is no configuration file changes
to make.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Useful Links:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/bb514961.aspx"&gt;Exposing WCF Services
to Client Script&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=cfeeb9f7-2a9e-40a5-99ce-dea714e3284d" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,cfeeb9f7-2a9e-40a5-99ce-dea714e3284d.aspx</comments>
      <category>.NET Framework</category>
      <category>AJAX</category>
      <category>ASP.NET</category>
      <category>C#</category>
      <category>Javascript</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=a79d6f30-2b6b-4707-85e0-3f4560b4f09e</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,a79d6f30-2b6b-4707-85e0-3f4560b4f09e.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,a79d6f30-2b6b-4707-85e0-3f4560b4f09e.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a79d6f30-2b6b-4707-85e0-3f4560b4f09e</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In a <a href="http://gotjeep.net/Blogs/PermaLink,guid,e29199af-6868-44d5-bd16-873aa770d39a.aspx">previous
post about the AJAX Extensions</a>, I detailed the copy commands to retrieve the DLLs
from the GAC. Same thing, this time for the ASP.NET 3.5 Extensions. If you are demoing
CTP material in a hosted environment, you will likely need these in your app's bin
to avoid the inevitable configuration error.
</p>
        <p>
copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.6.0.0__31bf3856ad364e35"
C:\dev\MMVCApp\bin<br />
copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions.Design\3.6.0.0__31bf3856ad364e35"
C:\dev\MMVCApp\bin
</p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=a79d6f30-2b6b-4707-85e0-3f4560b4f09e" />
      </body>
      <title>Getting your ASP.NET Futures DLLs out of the GAC</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,a79d6f30-2b6b-4707-85e0-3f4560b4f09e.aspx</guid>
      <link>http://offroadcoder.com/2008/01/21/GettingYourASPNETFuturesDLLsOutOfTheGAC.aspx</link>
      <pubDate>Mon, 21 Jan 2008 03:25:40 GMT</pubDate>
      <description>&lt;p&gt;
In a &lt;a href="http://gotjeep.net/Blogs/PermaLink,guid,e29199af-6868-44d5-bd16-873aa770d39a.aspx"&gt;previous
post about the AJAX Extensions&lt;/a&gt;, I detailed the copy commands to retrieve the DLLs
from the GAC. Same thing, this time for the ASP.NET 3.5 Extensions. If you are demoing
CTP material in a hosted environment, you will likely need these in your app's bin
to avoid the inevitable configuration error.
&lt;/p&gt;
&lt;p&gt;
copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.6.0.0__31bf3856ad364e35"
C:\dev\MMVCApp\bin&lt;br&gt;
copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions.Design\3.6.0.0__31bf3856ad364e35"
C:\dev\MMVCApp\bin
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=a79d6f30-2b6b-4707-85e0-3f4560b4f09e" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,a79d6f30-2b6b-4707-85e0-3f4560b4f09e.aspx</comments>
      <category>.NET Framework</category>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=a1477bfd-e498-42d3-b190-b84f7d27c259</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,a1477bfd-e498-42d3-b190-b84f7d27c259.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,a1477bfd-e498-42d3-b190-b84f7d27c259.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a1477bfd-e498-42d3-b190-b84f7d27c259</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A great series of blog posts by Scott Guthrie about the ASP.NET <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC</a> Framework
coming soon as part of the <a href="http://weblogs.asp.net/scottgu/archive/2007/11/29/net-web-product-roadmap-asp-net-silverlight-iis7.aspx">ASP.NET
3.5 Extensions release</a>. 
</p>
        <p>
Upon hearing the news, a few friends started questioning its intent, usefulness, and
longevity. Many of us have been using or contemplating conversion to the <a href="http://msdn.microsoft.com/msdnmag/issues/06/08/DesignPatterns/">MVP
pattern</a>, most recently using <a href="http://www.codeplex.com/websf">WCSF</a>.
The recent split of the MVP pattern by Fowler has caused many believers to question
their faith. While many are still "proving" MVP, MVC has been around for nearly 30
years. <a href="http://www.polymorphicpodcast.com/shows/aspnetmvc/">Some believe</a> that
MVP and MVC can co-exist. <a href="http://www.pnpguidance.net/Category/WebClientSoftwareFactory.aspx">Here</a> is
a comparison of MVP and MVC that concludes by painting an optimistic picture
of MVP and MVC contributing to each other.
</p>
        <p>
ASP.NET MVC appears to be the answer to my unit testing, REST, and code separation
prayers. Thank you ScottGu and team!
</p>
        <p>
          <a href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-3-5-extensions-ctp-preview-released.aspx">Check
it out!</a>
        </p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=a1477bfd-e498-42d3-b190-b84f7d27c259" />
      </body>
      <title>ASP.NET MVC</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,a1477bfd-e498-42d3-b190-b84f7d27c259.aspx</guid>
      <link>http://offroadcoder.com/2007/12/19/ASPNETMVC.aspx</link>
      <pubDate>Wed, 19 Dec 2007 02:06:20 GMT</pubDate>
      <description>&lt;p&gt;
A great series of blog posts by Scott Guthrie about the ASP.NET &lt;a href="http://en.wikipedia.org/wiki/Model-view-controller"&gt;MVC&lt;/a&gt; Framework
coming soon as part of the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/11/29/net-web-product-roadmap-asp-net-silverlight-iis7.aspx"&gt;ASP.NET
3.5 Extensions release&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Upon hearing the news, a few friends started questioning its intent, usefulness, and
longevity. Many of us have been using or contemplating conversion to the &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/08/DesignPatterns/"&gt;MVP
pattern&lt;/a&gt;, most recently using &lt;a href="http://www.codeplex.com/websf"&gt;WCSF&lt;/a&gt;.
The recent split of the MVP pattern by Fowler has caused many believers to question
their faith. While many are still "proving" MVP, MVC has been around for nearly 30
years. &lt;a href="http://www.polymorphicpodcast.com/shows/aspnetmvc/"&gt;Some believe&lt;/a&gt; that
MVP and MVC can co-exist. &lt;a href="http://www.pnpguidance.net/Category/WebClientSoftwareFactory.aspx"&gt;Here&lt;/a&gt; is
a comparison of MVP and MVC that concludes by painting&amp;nbsp;an optimistic picture
of MVP and MVC contributing to each other.
&lt;/p&gt;
&lt;p&gt;
ASP.NET MVC appears to be the answer to my unit testing, REST, and code separation
prayers. Thank you ScottGu and team!
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-3-5-extensions-ctp-preview-released.aspx"&gt;Check
it out!&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=a1477bfd-e498-42d3-b190-b84f7d27c259" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,a1477bfd-e498-42d3-b190-b84f7d27c259.aspx</comments>
      <category>.NET Framework</category>
      <category>AJAX</category>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
      <category>C#</category>
      <category>Javascript</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=41d6d631-cf1b-4cfe-9f92-488314ba3e78</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,41d6d631-cf1b-4cfe-9f92-488314ba3e78.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,41d6d631-cf1b-4cfe-9f92-488314ba3e78.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=41d6d631-cf1b-4cfe-9f92-488314ba3e78</wfw:commentRss>
      <slash:comments>8</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx">http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx</a>
        </p>
        <p>
I'm downloading it now.
</p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=41d6d631-cf1b-4cfe-9f92-488314ba3e78" />
      </body>
      <title>VS 2008 and .NET 3.5 Features</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,41d6d631-cf1b-4cfe-9f92-488314ba3e78.aspx</guid>
      <link>http://offroadcoder.com/2007/11/22/VS2008AndNET35Features.aspx</link>
      <pubDate>Thu, 22 Nov 2007 03:08:56 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I'm downloading it now.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=41d6d631-cf1b-4cfe-9f92-488314ba3e78" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,41d6d631-cf1b-4cfe-9f92-488314ba3e78.aspx</comments>
      <category>.NET Framework</category>
      <category>ASP.NET</category>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=00fc7c82-6dbd-4def-99ea-28a1eb7303b4</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,00fc7c82-6dbd-4def-99ea-28a1eb7303b4.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=00fc7c82-6dbd-4def-99ea-28a1eb7303b4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It's only a week away, and there are still spaces left.
</p>
        <p>
          <a href="http://codecamp07.jaxdug.com/">Information</a>   <a href="http://www.clicktoattend.com/?id=119680">Register</a>    <a href="http://codecamp07.jaxdug.com/Sessions/tabid/72/Default.aspx">Sessions</a></p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=00fc7c82-6dbd-4def-99ea-28a1eb7303b4" />
      </body>
      <title>2007 Jacksonville Code Camp</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,00fc7c82-6dbd-4def-99ea-28a1eb7303b4.aspx</guid>
      <link>http://offroadcoder.com/2007/08/17/2007JacksonvilleCodeCamp.aspx</link>
      <pubDate>Fri, 17 Aug 2007 03:42:12 GMT</pubDate>
      <description>&lt;p&gt;
It's only a week away, and there are still spaces left.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://codecamp07.jaxdug.com/"&gt;Information&lt;/a&gt;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.clicktoattend.com/?id=119680"&gt;Register&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://codecamp07.jaxdug.com/Sessions/tabid/72/Default.aspx"&gt;Sessions&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=00fc7c82-6dbd-4def-99ea-28a1eb7303b4" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,00fc7c82-6dbd-4def-99ea-28a1eb7303b4.aspx</comments>
      <category>.NET Framework</category>
      <category>AJAX</category>
      <category>ASP.NET</category>
      <category>C#</category>
      <category>Database</category>
      <category>General</category>
      <category>Javascript</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=e29199af-6868-44d5-bd16-873aa770d39a</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,e29199af-6868-44d5-bd16-873aa770d39a.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,e29199af-6868-44d5-bd16-873aa770d39a.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e29199af-6868-44d5-bd16-873aa770d39a</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Many hosting companies, like mine, won't have the AJAX Extensions installed in the
GAC for quite a while, if ever.   No worries, you can just put the DLLs
in your Bin folder.   Since MS hasn't graced us with the DLLs, so you'll
have to get them out of your GAC.  I haven't found a way to copy DLLs using Windows
Explorer, but command-line never fails.
</p>
        <p>
          <font color="#000080">copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\1.0.61025.0__31bf3856ad364e35"
C:\dev\MyApp\Bin\<br />
copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions.Design\1.0.61025.0__31bf3856ad364e35"
C:\dev\MyApp\Bin\</font>
        </p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=e29199af-6868-44d5-bd16-873aa770d39a" />
      </body>
      <title>Get the AJAX DLLs out of the GAC</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,e29199af-6868-44d5-bd16-873aa770d39a.aspx</guid>
      <link>http://offroadcoder.com/2007/02/10/GetTheAJAXDLLsOutOfTheGAC.aspx</link>
      <pubDate>Sat, 10 Feb 2007 19:50:00 GMT</pubDate>
      <description>&lt;p&gt;
Many hosting companies, like mine, won't have the AJAX Extensions installed in the
GAC for quite a while, if ever.&amp;nbsp;&amp;nbsp; No worries, you can just put the DLLs
in your Bin folder.&amp;nbsp;&amp;nbsp; Since MS hasn't graced us with the DLLs, so you'll
have to get them out of your GAC.&amp;nbsp; I haven't found a way to copy DLLs using Windows
Explorer, but command-line never fails.
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000080&gt;copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\1.0.61025.0__31bf3856ad364e35"
C:\dev\MyApp\Bin\&lt;br&gt;
copy "C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions.Design\1.0.61025.0__31bf3856ad364e35"
C:\dev\MyApp\Bin\&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=e29199af-6868-44d5-bd16-873aa770d39a" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,e29199af-6868-44d5-bd16-873aa770d39a.aspx</comments>
      <category>.NET Framework</category>
      <category>AJAX</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=4be2f278-12e4-40d5-b154-0e8ecaf18fac</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,4be2f278-12e4-40d5-b154-0e8ecaf18fac.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,4be2f278-12e4-40d5-b154-0e8ecaf18fac.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4be2f278-12e4-40d5-b154-0e8ecaf18fac</wfw:commentRss>
      <slash:comments>31</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I frequently place an UpdatePanel around a paged GridView with inline editing.  
During OnRowUpdating, the object is saved.   If the save was not successful,
I like to show an alert box with the error message.   
</p>
        <p>
I recently migrated from the Atlas May CTP to ASP.NET 2.0 AJAX.   The following
code worked with the May CTP, but, from my research, has not worked since July CTP:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
Page.ClientScript.RegisterStartupScript(<font color="#0000ff">typeof</font>(<font color="#0000ff">string</font>), <font color="#a52a2a">"alertScript"</font>, <font color="#a52a2a">"alert('Error
Message');"</font>, <font color="#0000ff">true</font>);
</p>
        </blockquote>
        <p>
However, our pals at Microsoft have given us something just as good.   I
found it by mistake while trying to put in a hack involving checking the value of <font color="#008080">ScriptManager</font><font color="#000000">.GetCurrent(Page).IsInAsyncPostBack</font>. 
Here is the AJAX-friendly equivalent:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <font color="#008080">
            <p>
ScriptManager
</p>
          </font>
          <font color="#000000">.RegisterStartupScript(<font color="#0000ff">this</font>.updatePanel, </font>
          <font color="#0000ff">typeof</font>
          <font color="#000000">(</font>
          <font color="#0000ff">string</font>
          <font color="#000000">), <font color="#a52a2a">"alertScript"</font>, <font color="#a52a2a">"alert('Error
Message');"</font>, </font>
          <font color="#0000ff">true</font>
          <font color="#000000">);</font>
        </blockquote>
        <p>
Hope this helps someone.  There are many blog posts, with many more comments, with
people compaining about this.
</p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=4be2f278-12e4-40d5-b154-0e8ecaf18fac" />
      </body>
      <title>ClientScript.RegisterStartupScript doesn't work with ASP.NET AJAX</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,4be2f278-12e4-40d5-b154-0e8ecaf18fac.aspx</guid>
      <link>http://offroadcoder.com/2007/02/10/ClientScriptRegisterStartupScriptDoesntWorkWithASPNETAJAX.aspx</link>
      <pubDate>Sat, 10 Feb 2007 13:21:42 GMT</pubDate>
      <description>&lt;p&gt;
I frequently place an UpdatePanel around a paged GridView with inline editing.&amp;nbsp;&amp;nbsp;
During OnRowUpdating, the object is saved.&amp;nbsp;&amp;nbsp; If the save was not successful,
I like to show an alert box with the error message.&amp;nbsp;&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
I recently migrated from the Atlas May CTP to ASP.NET 2.0 AJAX.&amp;nbsp;&amp;nbsp; The following
code worked with the May CTP, but, from my research, has not worked since July CTP:
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt; 
&lt;p&gt;
Page.ClientScript.RegisterStartupScript(&lt;font color=#0000ff&gt;typeof&lt;/font&gt;(&lt;font color=#0000ff&gt;string&lt;/font&gt;), &lt;font color=#a52a2a&gt;"alertScript"&lt;/font&gt;, &lt;font color=#a52a2a&gt;"alert('Error
Message');"&lt;/font&gt;, &lt;font color=#0000ff&gt;true&lt;/font&gt;);
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
However, our pals at Microsoft have given us something just as good.&amp;nbsp;&amp;nbsp; I
found it by mistake while trying to put in a hack involving checking the value of &lt;font color=#008080&gt;ScriptManager&lt;/font&gt;&lt;font color=#000000&gt;.GetCurrent(Page).IsInAsyncPostBack&lt;/font&gt;.&amp;nbsp;
Here is the AJAX-friendly equivalent:
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;font color=#008080&gt; 
&lt;p&gt;
ScriptManager
&lt;/font&gt;&lt;font color=#000000&gt;.RegisterStartupScript(&lt;font color=#0000ff&gt;this&lt;/font&gt;.updatePanel, &lt;/font&gt;&lt;font color=#0000ff&gt;typeof&lt;/font&gt;&lt;font color=#000000&gt;(&lt;/font&gt;&lt;font color=#0000ff&gt;string&lt;/font&gt;&lt;font color=#000000&gt;), &lt;font color=#a52a2a&gt;"alertScript"&lt;/font&gt;, &lt;font color=#a52a2a&gt;"alert('Error
Message');"&lt;/font&gt;, &lt;/font&gt;&lt;font color=#0000ff&gt;true&lt;/font&gt;&lt;font color=#000000&gt;);&lt;/font&gt;&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Hope this helps someone.&amp;nbsp; There are many blog posts, with many more comments,&amp;nbsp;with
people compaining about this.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=4be2f278-12e4-40d5-b154-0e8ecaf18fac" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,4be2f278-12e4-40d5-b154-0e8ecaf18fac.aspx</comments>
      <category>AJAX</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=6744a626-3e6b-4a2d-8ad7-bc72af3ec83f</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,6744a626-3e6b-4a2d-8ad7-bc72af3ec83f.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6744a626-3e6b-4a2d-8ad7-bc72af3ec83f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just migrated from the Atlas July CTP to ASP.NET 2.0 AJAX Extensions 1.0. 
After following all of the instructions on the AJAX site, my web site still showed
tons of errors.  I'm using a Web Site, not Web Application, with a ScriptManager
in a WebForm that uses a MasterPage.   Every page shows errors on AJAX tags.  
</p>
        <p>
Yes, I removed the Atlas DLL.  No, my web.config is not messed up.  Something
else is wrong here.   I <a href="http://mcosier.blogspot.com/2006/12/element-scriptmanager-is-not-known.html">found
a "fix"</a>.   The sequence of steps seems a little odd to me, but I did't
care, it worked.  However, the problem resurfaced when I closed my MasterPage.
</p>
        <p>
More searching led me to a great alternative to a true solution.   <a href="http://forums.asp.net/thread/1533306.aspx">An
ASP.NET Forums post</a> had some back-and-forth on the topic.  Ultimately, the
best solution at this point is to change the tagprefix to "ajax".   This
works great, and, in fact, I like it better because it separates the ajax controls
from the standard asp controls.
</p>
        <p>
          <font color="#0000ff" size="2">&lt;</font>
          <font color="#800000" size="2">add</font>
          <font color="#0000ff" size="2">
          </font>
          <font color="#ff0000" size="2">tagPrefix</font>
          <font color="#0000ff" size="2">=</font>
          <font color="#000000" size="2">"</font>
          <font color="#0000ff" size="2">ajax</font>
          <font color="#000000" size="2">"</font>
          <font color="#0000ff" size="2">
          </font>
          <font color="#ff0000" size="2">namespace</font>
          <font color="#0000ff" size="2">=</font>
          <font color="#000000" size="2">"</font>
          <font color="#0000ff" size="2">System.Web.UI</font>
          <font color="#000000" size="2">"</font>
          <font color="#0000ff" size="2">
          </font>
          <font color="#ff0000" size="2">assembly</font>
          <font color="#0000ff" size="2">=</font>
          <font color="#000000" size="2">"</font>
          <font color="#0000ff" size="2">System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</font>
          <font color="#000000" size="2">"</font>
          <font color="#0000ff" size="2">/&gt;
</font>
        </p>
        <p>
        </p>
        <p>
          <a href="http://mcosier.blogspot.com/2006/12/element-scriptmanager-is-not-known.html">
          </a>
        </p>
        <p>
        </p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=6744a626-3e6b-4a2d-8ad7-bc72af3ec83f" />
      </body>
      <title>'ScriptManager' is not a known element</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,6744a626-3e6b-4a2d-8ad7-bc72af3ec83f.aspx</guid>
      <link>http://offroadcoder.com/2007/02/08/ScriptManagerIsNotAKnownElement.aspx</link>
      <pubDate>Thu, 08 Feb 2007 02:34:09 GMT</pubDate>
      <description>&lt;p&gt;
I just migrated from the Atlas July CTP to ASP.NET 2.0 AJAX Extensions 1.0.&amp;nbsp;
After following all of the instructions on the AJAX site, my web site still showed
tons of errors.&amp;nbsp; I'm using a Web Site, not Web Application, with a ScriptManager
in a WebForm that uses a MasterPage.&amp;nbsp;&amp;nbsp; Every page shows errors on AJAX tags.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Yes, I removed the Atlas DLL.&amp;nbsp; No, my web.config is not messed up.&amp;nbsp; Something
else is wrong here.&amp;nbsp;&amp;nbsp; I &lt;a href="http://mcosier.blogspot.com/2006/12/element-scriptmanager-is-not-known.html"&gt;found
a "fix"&lt;/a&gt;.&amp;nbsp;&amp;nbsp; The sequence of steps seems a little odd to me, but I did't
care, it worked.&amp;nbsp; However, the problem resurfaced when I closed my MasterPage.
&lt;/p&gt;
&lt;p&gt;
More searching led me to a great alternative to a true solution.&amp;nbsp;&amp;nbsp; &lt;a href="http://forums.asp.net/thread/1533306.aspx"&gt;An
ASP.NET Forums post&lt;/a&gt; had some back-and-forth on the topic.&amp;nbsp; Ultimately, the
best solution at this point is to change the tagprefix to "ajax".&amp;nbsp;&amp;nbsp; This
works great, and, in fact, I like it better because it separates the ajax controls
from the standard asp controls.
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;add&lt;/font&gt;&lt;font color=#0000ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;tagPrefix&lt;/font&gt;&lt;font color=#0000ff size=2&gt;=&lt;/font&gt;&lt;font color=#000000 size=2&gt;"&lt;/font&gt;&lt;font color=#0000ff size=2&gt;ajax&lt;/font&gt;&lt;font color=#000000 size=2&gt;"&lt;/font&gt;&lt;font color=#0000ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;namespace&lt;/font&gt;&lt;font color=#0000ff size=2&gt;=&lt;/font&gt;&lt;font color=#000000 size=2&gt;"&lt;/font&gt;&lt;font color=#0000ff size=2&gt;System.Web.UI&lt;/font&gt;&lt;font color=#000000 size=2&gt;"&lt;/font&gt;&lt;font color=#0000ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;assembly&lt;/font&gt;&lt;font color=#0000ff size=2&gt;=&lt;/font&gt;&lt;font color=#000000 size=2&gt;"&lt;/font&gt;&lt;font color=#0000ff size=2&gt;System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&lt;/font&gt;&lt;font color=#000000 size=2&gt;"&lt;/font&gt;&lt;font color=#0000ff size=2&gt;/&amp;gt;
&lt;/p&gt;
&gt; 
&lt;p&gt;
&lt;p&gt;
&lt;a href="http://mcosier.blogspot.com/2006/12/element-scriptmanager-is-not-known.html"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=6744a626-3e6b-4a2d-8ad7-bc72af3ec83f" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,6744a626-3e6b-4a2d-8ad7-bc72af3ec83f.aspx</comments>
      <category>AJAX</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=4d4e4b7c-411b-4803-a645-255f102b3665</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,4d4e4b7c-411b-4803-a645-255f102b3665.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,4d4e4b7c-411b-4803-a645-255f102b3665.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4d4e4b7c-411b-4803-a645-255f102b3665</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I frequently store documents in the database for my ASP.NET apps, eliminating web
farm complications with shared drives, permissions, etc.  When uploading
a file, my Document class reads the uploaded file, zips the file with <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/">SharpZipLib</a>,
and inserts/updates in the database.   When opening a file, I have always
used an ASPX page that uses the Document class to unzip the file, and then changes
the Content-Disposition and ContentType headers, and then does a BinaryWrite
to the Response object to display the file.
</p>
        <p>
I have been using Handlers a lot lately, and figured that it was time to make this
process a little more elegant.  If you've never written a handler, it's quite
simple.  You need to make a web.config change, and add a new class that implementts
IHttpHandler.  All of the work is done in ProcessRequest.  Using the
default .ashx extension for the handler eliminates the need to make any changes in
IIS.  I thought about changing the handler to accept all requests with known
file extensions with the document ID as the filename, like 3383.pdf.  I just
figured that using the default extnesion would be easier.   Laziness
or efficiency, you decide.  Check out the code.
</p>
        <p>
          <strong>In &lt;system.web&gt; in web.config: 
<hr /></strong>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
                  <font color="#0000ff" size="2">&lt;</font>
                  <font color="#800000" size="2">httpHandlers</font>
                  <font color="#0000ff" size="2">&gt;</font>
                  <font size="2">
                    <br />
   </font>
                  <font color="#0000ff" size="2">&lt;</font>
                  <font color="#800000" size="2">add</font>
                  <font color="#ff00ff" size="2">
                  </font>
                  <font color="#ff0000" size="2">verb</font>
                  <font color="#0000ff" size="2">="*"</font>
                  <font color="#ff00ff" size="2">
                  </font>
                  <font color="#ff0000" size="2">path</font>
                  <font color="#0000ff" size="2">="DocumentHandler.ashx"</font>
                  <font color="#ff00ff" size="2">
                  </font>
                  <font color="#ff0000" size="2">type</font>
                  <font color="#0000ff" size="2">="TestingWebApp.DocumentHandler,
TestingWebApp"</font>
                  <font color="#ff00ff" size="2">
                  </font>
                  <font color="#0000ff" size="2">/&gt; </font>
                  <font size="2">
                    <br />
                  </font>
                  <font color="#0000ff" size="2">&lt;/</font>
                  <font color="#800000" size="2">httpHandlers</font>
                  <font color="#0000ff" size="2">&gt; 
<p></p></font>
                </span>
              </span>
            </span>
            <p>
              <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
                <font face="Verdana" size="2">
                  <strong>DocumentHandler.cs: 
<hr /></strong>
                </font>
              </span>
              <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
                <font face="Verdana" size="2">
                  <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
                    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Web;<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">namespace</span> TestingWebApp<br />
{<br />
    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> DocumentHandler
: IHttpHandler<br />
    {<br />
        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> DocumentId 
<br />
        {<br />
            get<br />
            {<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span>(System.Web.HttpContext.Current.Request.QueryString[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"DocumentId"</span>]
!<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span> &amp;&amp;
System.Web.HttpContext.Current.Request.QueryString[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"DocumentId"</span>].ToString().Length
&gt; 0) 
<br />
                    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span> Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"DocumentId"</span>]);<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span><br />
                    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ApplicationException(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Document
Handler requires a DocumentId"</span>);<br />
            }<br />
        }<br /><br />
        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">#region</span> IHttpHandler
Members<br /><br />
        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> ProcessRequest(System.Web.HttpContext
context)<br />
        {<br />
            context.Response.Cache.SetCacheability(HttpCacheability.Public);<br />
            context.Response.BufferOutput <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>;<br />
            <br />
            Document document <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Document.GetDocumentByDocumentId(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.DocumentId);<br /><br />
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">byte</span>[]
buffer <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> document.UnzippedBinary;<br />
            context.Response.ContentType <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> document.ContentType;<br />
            context.Response.OutputStream.Write(buffer,
0, buffer.Length);<br />
        }<br /><br />
        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">bool</span> IsReusable<br />
        {<br />
            get { <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>;
}<br />
        }<br /><br />
        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">#endregion</span><br />
    }<br />
}</span>
                </font>
              </span>
            </p>
          </span>
          <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=4d4e4b7c-411b-4803-a645-255f102b3665" />
        </p>
      </body>
      <title>ASP.NET Document Handler</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,4d4e4b7c-411b-4803-a645-255f102b3665.aspx</guid>
      <link>http://offroadcoder.com/2006/11/07/ASPNETDocumentHandler.aspx</link>
      <pubDate>Tue, 07 Nov 2006 04:31:15 GMT</pubDate>
      <description>&lt;p&gt;
I frequently store documents in the database for my ASP.NET apps, eliminating web
farm complications with shared drives, permissions, etc.&amp;nbsp;&amp;nbsp;When uploading
a file, my Document class reads the uploaded file, zips the file with &lt;a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/"&gt;SharpZipLib&lt;/a&gt;,
and inserts/updates in the database.&amp;nbsp;&amp;nbsp; When opening a file, I have always
used an ASPX&amp;nbsp;page that uses the Document class to unzip the file, and then changes
the Content-Disposition and ContentType headers,&amp;nbsp;and then does a BinaryWrite
to the Response object to display the file.
&lt;/p&gt;
&lt;p&gt;
I have been using Handlers a lot lately, and figured that it was time to make this
process a little more elegant.&amp;nbsp; If you've never written a handler, it's quite
simple.&amp;nbsp; You need to make a web.config change, and add a new class that implementts
IHttpHandler.&amp;nbsp; All of the work is done in ProcessRequest.&amp;nbsp;&amp;nbsp;Using the
default .ashx extension for the handler eliminates the need to make any changes in
IIS.&amp;nbsp; I thought about changing the handler to accept all requests with known
file extensions with the document ID as the filename, like 3383.pdf.&amp;nbsp; I just
figured that&amp;nbsp;using the default extnesion&amp;nbsp;would be easier.&amp;nbsp;&amp;nbsp; Laziness
or efficiency, you decide.&amp;nbsp; Check out the code.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;In &amp;lt;system.web&amp;gt; in web.config: 
&lt;hr&gt;
&lt;/strong&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;httpHandlers&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;/font&gt;&lt;font size=2&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;add&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;verb&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="*"&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;path&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="DocumentHandler.ashx"&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;type&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="TestingWebApp.DocumentHandler,
TestingWebApp"&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;/&amp;gt; &lt;/font&gt;&lt;font size=2&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;httpHandlers&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;&lt;strong&gt;DocumentHandler.cs: 
&lt;hr&gt;
&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Web;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;namespace&lt;/span&gt; TestingWebApp&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; DocumentHandler
: IHttpHandler&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt; DocumentId 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt;(System.Web.HttpContext.Current.Request.QueryString[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"DocumentId"&lt;/span&gt;]
!&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt; &amp;amp;&amp;amp;
System.Web.HttpContext.Current.Request.QueryString[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"DocumentId"&lt;/span&gt;].ToString().Length
&amp;gt; 0) 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"DocumentId"&lt;/span&gt;]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;throw&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ApplicationException(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Document
Handler requires a DocumentId"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;#region&lt;/span&gt; IHttpHandler
Members&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; ProcessRequest(System.Web.HttpContext
context)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;context.Response.Cache.SetCacheability(HttpCacheability.Public);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;context.Response.BufferOutput &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/span&gt;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Document document &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Document.GetDocumentByDocumentId(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.DocumentId);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;byte&lt;/span&gt;[]
buffer &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; document.UnzippedBinary;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;context.Response.ContentType &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; document.ContentType;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;context.Response.OutputStream.Write(buffer,
0, buffer.Length);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;bool&lt;/span&gt; IsReusable&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get { &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;;
}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;#endregion&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/span&gt;&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=4d4e4b7c-411b-4803-a645-255f102b3665" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,4d4e4b7c-411b-4803-a645-255f102b3665.aspx</comments>
      <category>.NET Framework</category>
      <category>ASP.NET</category>
      <category>C#</category>
      <category>Database</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=9fb50da8-81e4-4bc1-8084-80d15a51b368</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,9fb50da8-81e4-4bc1-8084-80d15a51b368.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:comment>http://offroadcoder.com/CommentView,guid,9fb50da8-81e4-4bc1-8084-80d15a51b368.aspx</wfw:comment>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9fb50da8-81e4-4bc1-8084-80d15a51b368</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The starter kit already allowed individual file upload, and batch upload from a directory
which requires files to be moved to Upload directory by FTP.  The starter kit
also stores the images in the database. While I prefer this method for most files,
I don't prefer it for images. I changed a few methods to store the images in an images
folder, and modified the image serving handler accordingly.  The album page load
time is a fraction of what it was with images in the database.
</p>
        <p>
I also created an XP Publishing Wizard that allows any user with credentials to create/choose
an album, and upload images from Windows XP. The beauty of the XPPW is that it can
resize the images before uploading. That way all of us with 10 megapixel cameras no
longer have to spend any extra time resizing to prevent reaching a web host storage
quota.
</p>
        <p>
A few articles helped me figure this stuff out:
</p>
        <ul>
          <li>
            <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/publishing_wizard/pubwiz_intro.asp">MSDN
Publishing Wizard Introduction</a>
          </li>
          <li>
            <a href="http://www.zonageek.com/articulos/web/programming_microsofts_publishing_wizards/index.php">Zonageek
articulo</a>
          </li>
        </ul>
        <p>
Creating the wizard was easy enough.  You first need to create a registry entry
in the following format:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font color="#000080">Windows
Registry Editor Version 5.00<br /><br />
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard\PublishingWizard\Providers\Your
Photo Gallery]<br />
"displayname"="Your Photo Gallery"<br />
"description"="Online Photo Albums"<br />
"href"="http://www.yoursite.net/XPPublish.aspx"<br />
"icon"="http://www.yoursite.net/favicon.ico"
</font>
          </span>
        </p>
        <p>
          <font face="Verdana" color="#000000" size="2">Next is a single aspx page that accepts
the files.  The page handles user login, album creation/selection, and accepts
multiple files in a single form post.  All the hard work is done
by some javascript methods that handle the XML sent from Windows XP.  The
javascript looks like this:</font>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">        <font color="#0000ff">&lt;<font color="#a52a2a">script</font><font color="#ff0000">language</font>='javascript'&gt;<br /></font>            <font color="#0000ff">function</font> startUpload()<br />
            {<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> xml <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> window.external.Property("TransferManifest");<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> files <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml.selectNodes("transfermanifest/filelist/file");<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> albumId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> document.getElementById("Album").value;<br /><br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">for</span> (i <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 0;
i &lt; files.length; i++)<br />
                {<br />
                    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> postTag <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml.createNode(1,
"post", "");<br />
                    postTag.setAttribute("href",
"<a href="http://yoursite.net/XPPublish.aspx">http:<span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//yoursite.net/XPPublish.aspx
</span></a>");</span>
          <br />
                    postTag.setAttribute("name",
"userpicture");<br /><br />
                    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> dataTag <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml.createNode(1,
"formdata", "");<br />
                    dataTag.setAttribute("name",
"MAX_FILE_SIZE");<br />
                    dataTag.text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> "10000000";                    <br />
                    postTag.appendChild(dataTag);<br />
                    <br />
                    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> dataTag1 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml.createNode(1,
"formdata", "");<br />
                    dataTag1.setAttribute("name",
"btnUpload");<br />
                    dataTag1.text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> "Save";<br />
                    postTag.appendChild(dataTag1);<br />
                    <br />
                    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> dataTag2 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml.createNode(1,
"formdata", "");<br />
                    dataTag2.setAttribute("name",
"hidAlbumId");<br />
                    dataTag2.text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> albumId;<br />
                    postTag.appendChild(dataTag2);<br /><br />
                    files.item(i).appendChild(postTag);<br />
                }<br />
                <br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> uploadTag <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml.createNode(1,
"uploadinfo", "");<br />
                uploadTag.setAttribute("friendlyname",
"Family Photo Gallery");<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">var</span> htmluiTag <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml.createNode(1,
"htmlui", "");<br />
                htmluiTag.text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> "http:<span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//yoursite.net/Personal/Albums/Photos.aspx?AlbumID="
+ albumId;</span><br />
                uploadTag.appendChild(htmluiTag);<br /><br />
                xml.documentElement.appendChild(uploadTag);<br /><br />
                window.external.Property("TransferManifest") <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml;<br />
                window.external.SetWizardButtons(true,true,true);<br />
                document.getElementById("divContent").innerHtml <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> xml;<br />
                window.external.FinalNext();<br />
            }<br /><br />
            <font color="#0000ff">function</font> OnBack()<br />
            {<br />
                window.external.FinalBack();<br />
                window.external.SetWizardButtons(false,true,false);<br />
            }<br /><br />
            <font color="#0000ff">function</font> OnNext()<br />
            {<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (document.getElementById("divLogin"))<br />
                {<br />
                    document.getElementById("LoginArea_Login1_LoginButton").click();<br />
                }<br />
                <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span><br />
                {<br />
                    startUpload();<br />
                }<br />
            }<br /><br />
            <font color="#0000ff">function</font> OnCancel()<br />
            {<br />
            }<br /><br />
            <font color="#0000ff">function</font> window.onload()<br />
            {<br />
                window.external.SetHeaderText('Photo
Gallery','Your Photos');<br />
                window.external.SetWizardButtons(true,true,false);<br />
            }<br />
        <font color="#0000ff">&lt;/<font color="#a52a2a">script</font>&gt;</font></p>
        <p>
          <font face="Verdana" color="#000000" size="2">In case you haven't seen the XP Publishing
Wizard in action, check out these screenshots:</font>
        </p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_1.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_2.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_3.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_4.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_5.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_6.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_7.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_8.gif" border="0" />
        </p>
        <p>
 
</p>
        <p>
          <img src="http://www.gotjeep.net/Blogs/content/binary/xppw_9.gif" border="0" />
        </p>
        <p>
 
</p>
        <font face="Courier New" color="#008000">
        </font>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=9fb50da8-81e4-4bc1-8084-80d15a51b368" />
      </body>
      <title>Building upon the ASP.NET Personal Web Site Starter Kit</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,9fb50da8-81e4-4bc1-8084-80d15a51b368.aspx</guid>
      <link>http://offroadcoder.com/2006/11/06/BuildingUponTheASPNETPersonalWebSiteStarterKit.aspx</link>
      <pubDate>Mon, 06 Nov 2006 02:35:38 GMT</pubDate>
      <description>&lt;p&gt;
The starter kit already allowed individual file upload, and batch upload from a directory
which requires files to be moved to Upload directory by FTP.&amp;nbsp; The starter kit
also stores&amp;nbsp;the images in the database. While I prefer this method for most files,
I don't prefer it for images. I changed a few methods to store the images in an images
folder, and modified the image serving handler accordingly.&amp;nbsp; The album page load
time is a fraction of what it was with images in the database.
&lt;/p&gt;
&lt;p&gt;
I also created an XP Publishing Wizard that allows any user with credentials to create/choose
an album, and upload images from Windows XP. The beauty of the XPPW is that it can
resize the images before uploading. That way all of us with 10 megapixel cameras no
longer have to spend any extra time resizing to prevent reaching a web host storage
quota.
&lt;/p&gt;
&lt;p&gt;
A few articles helped me figure this stuff out:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/publishing_wizard/pubwiz_intro.asp"&gt;MSDN
Publishing Wizard Introduction&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.zonageek.com/articulos/web/programming_microsofts_publishing_wizards/index.php"&gt;Zonageek
articulo&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Creating the wizard was easy enough.&amp;nbsp; You first need to create a registry entry
in the following format:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font color=#000080&gt;Windows
Registry Editor Version 5.00&lt;br&gt;
&lt;br&gt;
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard\PublishingWizard\Providers\Your
Photo Gallery]&lt;br&gt;
"displayname"="Your Photo Gallery"&lt;br&gt;
"description"="Online Photo Albums"&lt;br&gt;
"href"="http://www.yoursite.net/XPPublish.aspx"&lt;br&gt;
"icon"="http://www.yoursite.net/favicon.ico"
&lt;/p&gt;
&lt;p&gt;
&lt;font face=Verdana color=#000000 size=2&gt;Next is a single aspx page that accepts the
files.&amp;nbsp;&amp;nbsp;The page handles user login, album creation/selection, and accepts
multiple files&amp;nbsp;in a single form post.&amp;nbsp;&amp;nbsp;All the&amp;nbsp;hard work is done
by&amp;nbsp;some javascript methods that handle the XML sent from Windows XP.&amp;nbsp; The
javascript looks like this:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;&amp;lt;&lt;font color=#a52a2a&gt;script&lt;/font&gt; &lt;font color=#ff0000&gt;language&lt;/font&gt;='javascript'&amp;gt;&lt;br&gt;
&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;function&lt;/font&gt; startUpload()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; xml &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; window.external.Property("TransferManifest");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; files &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml.selectNodes("transfermanifest/filelist/file");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; albumId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; document.getElementById("Album").value;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;for&lt;/span&gt; (i &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 0;
i &amp;lt; files.length; i++)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; postTag &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml.createNode(1,
"post", "");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;postTag.setAttribute("href",
"&lt;a href="http://yoursite.net/XPPublish.aspx"&gt;http:&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//yoursite.net/XPPublish.aspx
&lt;/a&gt;");&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;postTag.setAttribute("name",
"userpicture");&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; dataTag &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml.createNode(1,
"formdata", "");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataTag.setAttribute("name",
"MAX_FILE_SIZE");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataTag.text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; "10000000";&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;postTag.appendChild(dataTag);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; dataTag1 &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml.createNode(1,
"formdata", "");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataTag1.setAttribute("name",
"btnUpload");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataTag1.text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; "Save";&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;postTag.appendChild(dataTag1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; dataTag2 &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml.createNode(1,
"formdata", "");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataTag2.setAttribute("name",
"hidAlbumId");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataTag2.text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; albumId;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;postTag.appendChild(dataTag2);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;files.item(i).appendChild(postTag);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; uploadTag &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml.createNode(1,
"uploadinfo", "");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uploadTag.setAttribute("friendlyname",
"Family Photo Gallery");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;var&lt;/span&gt; htmluiTag &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml.createNode(1,
"htmlui", "");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;htmluiTag.text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; "http:&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//yoursite.net/Personal/Albums/Photos.aspx?AlbumID="
+ albumId;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uploadTag.appendChild(htmluiTag);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xml.documentElement.appendChild(uploadTag);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.external.Property("TransferManifest") &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.external.SetWizardButtons(true,true,true);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.getElementById("divContent").innerHtml &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; xml;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.external.FinalNext();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;function&lt;/font&gt; OnBack()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.external.FinalBack();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.external.SetWizardButtons(false,true,false);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;function&lt;/font&gt; OnNext()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (document.getElementById("divLogin"))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.getElementById("LoginArea_Login1_LoginButton").click();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;startUpload();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;function&lt;/font&gt; OnCancel()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;function&lt;/font&gt; window.onload()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.external.SetHeaderText('Photo
Gallery','Your Photos');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.external.SetWizardButtons(true,true,false);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;&amp;lt;/&lt;font color=#a52a2a&gt;script&lt;/font&gt;&amp;gt;&lt;/font&gt;&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face=Verdana color=#000000 size=2&gt;In case you haven't seen the XP Publishing
Wizard in action, check out these screenshots:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&gt;&gt;&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_1.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_2.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_3.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_4.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_5.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_6.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_7.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_8.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.gotjeep.net/Blogs/content/binary/xppw_9.gif" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;font face="Courier New" color=#008000&gt;&lt;/font&gt;&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=9fb50da8-81e4-4bc1-8084-80d15a51b368" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,9fb50da8-81e4-4bc1-8084-80d15a51b368.aspx</comments>
      <category>ASP.NET</category>
      <category>Javascript</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=97de7191-5c32-42c4-b846-5dd71623937a</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,97de7191-5c32-42c4-b846-5dd71623937a.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=97de7191-5c32-42c4-b846-5dd71623937a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Rick Strahl delivered another excellent white paper. In addition to his white papers,
he has one of the most readable and intelligent blogs on the web. 
</p>
        <p>
White paper: <a href="http://west-wind.com/weblog/posts/2725.aspx">Past the AJAX Hype
- some things to think about</a></p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=97de7191-5c32-42c4-b846-5dd71623937a" />
      </body>
      <title>Great AJAX article</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,97de7191-5c32-42c4-b846-5dd71623937a.aspx</guid>
      <link>http://offroadcoder.com/2005/08/31/GreatAJAXArticle.aspx</link>
      <pubDate>Wed, 31 Aug 2005 01:57:57 GMT</pubDate>
      <description>&lt;p&gt;
Rick Strahl delivered another excellent white paper. In addition to his white papers,
he has one of the most readable and intelligent blogs on the web. 
&lt;/p&gt;
&lt;p&gt;
White paper: &lt;a href="http://west-wind.com/weblog/posts/2725.aspx"&gt;Past the AJAX Hype
- some things to think about&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=97de7191-5c32-42c4-b846-5dd71623937a" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,97de7191-5c32-42c4-b846-5dd71623937a.aspx</comments>
      <category>AJAX</category>
      <category>ASP.NET</category>
      <category>Javascript</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=2d93ecd8-b0da-48d3-a703-72b06d1d7511</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,2d93ecd8-b0da-48d3-a703-72b06d1d7511.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2d93ecd8-b0da-48d3-a703-72b06d1d7511</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Dmitri Khanine and Phil Carrillo author this fine article on Javascript RPC. Finally,
an article that mentions separation of business and presentation logic, and implementing
MVC in ASP.NET. We need more patterns and practices discussions, and a lot less "look
what I can do" articles.
</p>
        <p>
MSDN Article: <a href="http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/lifewithoutrefresh.asp">Life
without Refresh</a></p>
        <img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=2d93ecd8-b0da-48d3-a703-72b06d1d7511" />
      </body>
      <title>Javascript RPC</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,2d93ecd8-b0da-48d3-a703-72b06d1d7511.aspx</guid>
      <link>http://offroadcoder.com/2005/07/24/JavascriptRPC.aspx</link>
      <pubDate>Sun, 24 Jul 2005 02:01:30 GMT</pubDate>
      <description>&lt;p&gt;
Dmitri Khanine and Phil Carrillo author this fine article on Javascript RPC. Finally,
an article that mentions separation of business and presentation logic, and implementing
MVC in ASP.NET. We need more patterns and practices discussions, and a lot less "look
what I can do" articles.
&lt;/p&gt;
&lt;p&gt;
MSDN Article: &lt;a href="http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/lifewithoutrefresh.asp"&gt;Life
without Refresh&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=2d93ecd8-b0da-48d3-a703-72b06d1d7511" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,2d93ecd8-b0da-48d3-a703-72b06d1d7511.aspx</comments>
      <category>AJAX</category>
      <category>ASP.NET</category>
      <category>Javascript</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=e90626ae-090e-4a30-abec-d5ef86b35e63</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,e90626ae-090e-4a30-abec-d5ef86b35e63.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e90626ae-090e-4a30-abec-d5ef86b35e63</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Devloping an application using the System.Web.Mail.SmtpMail class to send email should
not be as difficult as it always is. <a href="http://www.systemwebmail.com/">http://www.systemwebmail.com</a> has
a detailed and helpful collection of possible fixes for the dreaded "Could not access
'CDO.Message' Object" Exception. The one I most recently experienced was not listed.
We thought it could be a relaying perrmission or something related to setting the
SmtpServer name. It turned out to be a Windows 2003-specific problem related to Fixed
Identity Impersonation for high security (isolated) applications using a low-privilege
user account specific to the application. 
</p>
        <p>
The exception you see, almost always the useless excpetion, "Could not access 'CDO.Message'
Object", does not help you to troubleshoot. As you can see in the code below, generated
using <a href="http://www.aisto.com/roeder/dotnet/">Lutz Roeder's .NET Reflector</a>,
called by SmtpMail.Send(), the real exception is never thrown. It will throw the "Could
not access 'CDO.Message' Object" exception no matter what exception was caught.
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">internal</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> CallMethod(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> obj, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> methodName, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span>[]
args)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  
object</span> obj1;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  
try</span><br />
   {<br />
      obj1 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> SmtpMail.LateBoundAccessHelper.CallMethod(<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">        
this</span>.LateBoundType, obj, methodName, args);<br />
   }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  
catch</span> (Exception exception1)<br />
   {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">     
throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> HttpException(HttpRuntime.FormatResourceString(<br /><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">        
"Could_not_access_object"</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>._progId),
exception1);<br />
   }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  
return</span> obj1;<br />
} </span>
        </p>
        <p>
The best advice given by <a href="http://www.systemwebmail.com/">http://www.systemwebmail.com</a> is
to loop through all of the InnerExceptions thrown when the useless exception is thrown.
This will allow you to see the true exception and determine how to fix the problem.
</p>
        <p>
In Windows 2003, you can have each application run in its own application pool using
an application-specific user account. Depending on the privileges and group memberships
of this user account, it may or may not have the correct permissions to be able to
send mail using the machine's SMTP server. To send mail, the user account needs to
have write permissions on the directory named C:\inetpub\mailroot\Pickup. With those
permissions, System.Web.Mail (.NET wrapper around CDOSys.dll) will create a .eml file
in that directory. The mail gets sent when the SMTP service, with SYSTEM privileges,
sees this file and sends the email.
</p>
        <p>
If granting the necessary permissions is not possible for your application's user
account, you can bypass System.Web.Mail's default CDO send method, using the Pickup
directory, altogether. You can modify the mail message's configuration fields to set
the values used by CDO, regardless of the values set by System.Web.Mail.
</p>
        <p>
You can send the mail message by going through the smtp port instead of the pickup
directory (default). Change the <i>sendusing</i> configuration field from 0 (default
- pickup directory) to 1 (port). 
</p>
        <code>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">mailMsg.Fields.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/cdo/configuration/sendusing"</span>,
1);</span>
          </p>
        </code>
        <p>
          <code>
          </code>If you still cannot send email, try using other CDO configuration fields
to bypass the System.Web.Mail settings. Here are some other configuration fields.
I would try them in this order: 
</p>
        <code>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
smtpauthenticate values (2=NTLM, 1=Basic, 0=None)</span>
              <br />
mailMsg.Fields.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"</span>,
1);<br />
mailMsg.Fields.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/cdo/configuration/smtpserverport"</span>,
25);<br />
mailMsg.Fields.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/cdo/configuration/smtpserver"</span>,
mailServer);<br />
mailMsg.Fields.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/cdo/configuration/sendusername"</span>,
username);<br />
mailMsg.Fields.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/cdo/configuration/sendpassword"</span>,
pw);<br />
mailMsg.Fields.Add(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"</span>,
10); </span>
          </p>
        </code>
        <hr />
Of course, all of this is only possible if you are using .NET Framework 1.1. The Fields
property of the MailMessage class was not exposed in version 1.0 of the framework. 
<p></p><img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=e90626ae-090e-4a30-abec-d5ef86b35e63" /></body>
      <title>System.Web.Mail issues in Windows Server 2003</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,e90626ae-090e-4a30-abec-d5ef86b35e63.aspx</guid>
      <link>http://offroadcoder.com/2005/06/05/SystemWebMailIssuesInWindowsServer2003.aspx</link>
      <pubDate>Sun, 05 Jun 2005 02:02:18 GMT</pubDate>
      <description>&lt;p&gt;
Devloping an application using the System.Web.Mail.SmtpMail class to send email should
not be as difficult as it always is. &lt;a href="http://www.systemwebmail.com/"&gt;http://www.systemwebmail.com&lt;/a&gt; has
a detailed and helpful collection of possible fixes for the dreaded "Could not access
'CDO.Message' Object" Exception. The one I most recently experienced was not listed.
We thought it could be a relaying perrmission or something related to setting the
SmtpServer name. It turned out to be a Windows 2003-specific problem related to Fixed
Identity Impersonation for high security (isolated) applications using a low-privilege
user account specific to the application. 
&lt;p&gt;
The exception you see, almost always the useless excpetion, "Could not access 'CDO.Message'
Object", does not help you to troubleshoot. As you can see in the code below, generated
using &lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;Lutz Roeder's .NET Reflector&lt;/a&gt;,
called by SmtpMail.Send(), the real exception is never thrown. It will throw the "Could
not access 'CDO.Message' Object" exception no matter what exception was caught.
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;internal&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; CallMethod(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; obj, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; methodName, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt;[]
args)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;
object&lt;/span&gt; obj1;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;
try&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obj1 &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; SmtpMail.LateBoundAccessHelper.CallMethod(&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
this&lt;/span&gt;.LateBoundType, obj, methodName, args);&lt;br&gt;
&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;
catch&lt;/span&gt; (Exception exception1)&lt;br&gt;
&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
throw&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; HttpException(HttpRuntime.FormatResourceString(&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
"Could_not_access_object"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;._progId),
exception1);&lt;br&gt;
&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;
return&lt;/span&gt; obj1;&lt;br&gt;
} &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The best advice given by &lt;a href="http://www.systemwebmail.com/"&gt;http://www.systemwebmail.com&lt;/a&gt; is
to loop through all of the InnerExceptions thrown when the useless exception is thrown.
This will allow you to see the true exception and determine how to fix the problem.
&lt;/p&gt;
&lt;p&gt;
In Windows 2003, you can have each application run in its own application pool using
an application-specific user account. Depending on the privileges and group memberships
of this user account, it may or may not have the correct permissions to be able to
send mail using the machine's SMTP server. To send mail, the user account needs to
have write permissions on the directory named C:\inetpub\mailroot\Pickup. With those
permissions, System.Web.Mail (.NET wrapper around CDOSys.dll) will create a .eml file
in that directory. The mail gets sent when the SMTP service, with SYSTEM privileges,
sees this file and sends the email.
&lt;/p&gt;
&lt;p&gt;
If granting the necessary permissions is not possible for your application's user
account, you can bypass System.Web.Mail's default CDO send method, using the Pickup
directory, altogether. You can modify the mail message's configuration fields to set
the values used by CDO, regardless of the values set by System.Web.Mail.
&lt;/p&gt;
&lt;p&gt;
You can send the mail message by going through the smtp port instead of the pickup
directory (default). Change the &lt;i&gt;sendusing&lt;/i&gt; configuration field from 0 (default
- pickup directory) to 1 (port). 
&lt;/p&gt;
&lt;code&gt; 
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;mailMsg.Fields.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/cdo/configuration/sendusing"&lt;/span&gt;,
1);&lt;/span&gt;
&lt;/p&gt;
&lt;/code&gt; 
&lt;p&gt;
&lt;code&gt;&lt;/code&gt;If you still cannot send email, try using other CDO configuration fields
to bypass the System.Web.Mail settings. Here are some other configuration fields.
I would try them in this order: 
&lt;/p&gt;
&lt;code&gt; 
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
smtpauthenticate values (2=NTLM, 1=Basic, 0=None)&lt;/span&gt;
&lt;br&gt;
mailMsg.Fields.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"&lt;/span&gt;,
1);&lt;br&gt;
mailMsg.Fields.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/cdo/configuration/smtpserverport"&lt;/span&gt;,
25);&lt;br&gt;
mailMsg.Fields.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/cdo/configuration/smtpserver"&lt;/span&gt;,
mailServer);&lt;br&gt;
mailMsg.Fields.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/cdo/configuration/sendusername"&lt;/span&gt;,
username);&lt;br&gt;
mailMsg.Fields.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/cdo/configuration/sendpassword"&lt;/span&gt;,
pw);&lt;br&gt;
mailMsg.Fields.Add(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"&lt;/span&gt;,
10); &lt;/span&gt;
&lt;/p&gt;
&lt;/code&gt; 
&lt;hr&gt;
Of course, all of this is only possible if you are using .NET Framework 1.1. The Fields
property of the MailMessage class was not exposed in version 1.0 of the framework. 
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=e90626ae-090e-4a30-abec-d5ef86b35e63" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,e90626ae-090e-4a30-abec-d5ef86b35e63.aspx</comments>
      <category>ASP.NET</category>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://offroadcoder.com/Trackback.aspx?guid=6fc7ac74-39b7-480c-80d5-6f8b77fa66e4</trackback:ping>
      <pingback:server>http://offroadcoder.com/pingback.aspx</pingback:server>
      <pingback:target>http://offroadcoder.com/PermaLink,guid,6fc7ac74-39b7-480c-80d5-6f8b77fa66e4.aspx</pingback:target>
      <dc:creator>Scott Klueppel</dc:creator>
      <georss:point>30.109017 -81.497099</georss:point>
      <wfw:commentRss>http://offroadcoder.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6fc7ac74-39b7-480c-80d5-6f8b77fa66e4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
DropDownLists within a Repeater appear to lose or forget which item is selected before
the page loads. This is not the case. Dynamically created DropDownLists inside of
a Repeater create a rare obstacle. The SelectedItem is not being lost or forgotten.
It only appears that way because the OnDataBinding event for the DropDownList is being
called twice. Only when the RepeaterItem containing the DropDownList calls its own
DataBind method is the data actually bound to the DropDownList. Consider the following
code: 
</p>
        <p>
          <code>
            <font size="3">
              <font size="2">
                <font color="green">// UsingDropDownLists.aspx</font>
                <br />
115 <font color="blue">&lt;</font><font color="brown">asp:Repeater</font><font color="red">id</font><font color="blue">="rptOne"</font><font color="red">runat</font><font color="blue">="server"</font><font color="red">OnItemCreated</font><font color="blue">="rptOne_ItemCreated"/&gt;</font><br />
116  <font color="blue">&lt;</font><font color="brown">ItemTemplate</font><font color="blue">&gt;</font><br />
117    <font color="blue">&lt;</font><font color="brown">asp:Literal</font><font color="red">id</font><font color="blue">="litQuestion"</font><font color="red">runat</font><font color="blue">="server"</font><font color="blue">/&gt;</font><br />
118    <font color="blue">&lt;</font><font color="brown">asp:DropDownList</font><font color="red">id</font><font color="blue">="ddlResponse"</font><font color="red">runat</font><font color="blue">="server"</font><font color="blue">/&gt;</font><br />
119    <font color="blue">&lt;</font><font color="brown">br</font><font color="blue">/&gt;</font><br />
120  <font color="blue">&lt;/</font><font color="brown">ItemTemplate</font><font color="blue">&gt;</font><br />
121 <font color="blue">&lt;/</font><font color="brown">asp:Repeater</font><font color="blue">&gt;</font><br /><br /><font color="green">// UsingDropDownLists.aspx.cs</font><br />
211 <font color="blue">protected void</font> rptOne_ItemCreated(<font color="blue">object</font> sender,
RepeaterItemEventArgs e)<br />
212 {<br />
213   <font color="blue">if</font>(e.Item.DataItem != null)<br />
214   { 
<br />
215     MyClass myClass = sender <font color="blue">as</font> MyClass;<br />
216     (e.Item.FindControl("litQuestion") <font color="blue">as</font> Literal).Text
= myClass.Question;<br />
217     DropDownList ddl = e.Item.FindControl("ddlResponse") <font color="blue">as</font> DropDownList;<br />
218     ddl.DataSource = GetResponseList(myClass.AvailableResponses);<br />
219     ddl.Items.FindByValue(myClass.Response).Selected = <font color="blue">true</font>;<br />
220     ddl.DataBind();<br />
221     ddl.SelectedIndex = e.Item.ItemIndex%(ddl.Items.Count-1); <font color="darkgreen">//Random</font><br />
222   }<br />
223 }</font>
            </font>
          </code>
        </p>
Here is the sequence of events: 
<ol><li>
Page_Load 
</li><li>
Data Retrieval/Bind Data to Repeater 
</li><li>
Repeater's ItemCreated event fires for each RepeaterItem 
</li><li>
Data Retrieval/Bind Data to DropDownList 
</li><li>
OnDataBinding is fired from the DropDownList's DataBind() (line 220). However, if
you watch in debug mode, you will see that the DropDownList has no ListItems yet. 
</li><li>
DropDownList's SelectedIndex is chosen (line 221). Although, at this point, the DropDownList
still has no ListItems. The SelectedIndex call falls on deaf ears. 
</li><li>
RepeaterItem's DataBind method performs an actual DataBind on the DropDownList. There
are no selected items at this point. 
</li></ol><p>
RepeaterItem inherits from Control. If you look at Control's DataBind() method in <a href="http://www.aisto.com/roeder/dotnet/" target="_new">Lutz
Roeder's .NET Reflector</a>, you will see that it performs a DataBind on each of its
child controls. 
</p><p><span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">virtual</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> DataBind()<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  
this</span>.OnDataBinding(EventArgs.Empty);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  
if</span> (<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>._controls
!<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)<br />
   {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">     
string</span> text1 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>._controls.SetCollectionReadOnly(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Parent_collections_readonly"</span>);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">     
int</span> num1 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>._controls.Count;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">     
for</span> (<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> num2 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 0;
num2 &lt; num1; num2++)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         this</span>._controls[num2].DataBind();<br />
      }</span><br /><span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">     
this</span>._controls.SetCollectionReadOnly(text1);<br />
   }<br />
}</span></p><p>
From this, we can see three things. 
</p><ol><li>
The only safe time to choose the SelectedItem is after the binding of all objects
within the Repeater. A perfect place to do this is in the RepeaterItem's PreRender
or in the Repeater's PreRender. You have access to the same bound object from RepeaterItem.DataItem,
and can find the DropDownList and choose the SelectedIndex, SelectedValue, or ddl.Items.FindByValue(response).Selected
= true; 
</li><li>
The DataBind() call (line 220) is completely unnecessary and leads the programmer
to believe that it has actually bound the data. This is untrue. Again, in debug mode,
you will see that by line 221, there are still zero ListItems in ddl.Items. 
</li><li>
The same obstacle will arise for all Controls derived from ListControl. This includes
CheckBoxList, DropDownList, ListBox, and RadioButtonList. The same solution will apply
to these controls within a Repeater. 
</li></ol><p></p><img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=6fc7ac74-39b7-480c-80d5-6f8b77fa66e4" /></body>
      <title>Why is my DropDownList losing the SelectedItem inside a Repeater?</title>
      <guid isPermaLink="false">http://offroadcoder.com/PermaLink,guid,6fc7ac74-39b7-480c-80d5-6f8b77fa66e4.aspx</guid>
      <link>http://offroadcoder.com/2004/10/17/WhyIsMyDropDownListLosingTheSelectedItemInsideARepeater.aspx</link>
      <pubDate>Sun, 17 Oct 2004 02:03:32 GMT</pubDate>
      <description>&lt;p&gt;
DropDownLists within a Repeater appear to lose or forget which item is selected before
the page loads. This is not the case. Dynamically created DropDownLists inside of
a Repeater create a rare obstacle. The SelectedItem is not being lost or forgotten.
It only appears that way because the OnDataBinding event for the DropDownList is being
called twice. Only when the RepeaterItem containing the DropDownList calls its own
DataBind method is the data actually bound to the DropDownList. Consider the following
code: 
&lt;p&gt;
&lt;code&gt;&lt;font size=3&gt;&lt;font size=2&gt;&lt;font color=green&gt;// UsingDropDownLists.aspx&lt;/font&gt;
&lt;br&gt;
115&amp;nbsp;&lt;font color=blue&gt;&amp;lt;&lt;/font&gt;&lt;font color=brown&gt;asp:Repeater&lt;/font&gt; &lt;font color=red&gt;id&lt;/font&gt;&lt;font color=blue&gt;="rptOne"&lt;/font&gt; &lt;font color=red&gt;runat&lt;/font&gt;&lt;font color=blue&gt;="server"&lt;/font&gt; &lt;font color=red&gt;OnItemCreated&lt;/font&gt;&lt;font color=blue&gt;="rptOne_ItemCreated"/&amp;gt;&lt;/font&gt;
&lt;br&gt;
116&amp;nbsp;&amp;nbsp;&lt;font color=blue&gt;&amp;lt;&lt;/font&gt;&lt;font color=brown&gt;ItemTemplate&lt;/font&gt;&lt;font color=blue&gt;&amp;gt;&lt;/font&gt;
&lt;br&gt;
117&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=blue&gt;&amp;lt;&lt;/font&gt;&lt;font color=brown&gt;asp:Literal&lt;/font&gt; &lt;font color=red&gt;id&lt;/font&gt;&lt;font color=blue&gt;="litQuestion"&lt;/font&gt; &lt;font color=red&gt;runat&lt;/font&gt;&lt;font color=blue&gt;="server"&lt;/font&gt;&lt;font color=blue&gt;/&amp;gt;&lt;/font&gt;
&lt;br&gt;
118&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=blue&gt;&amp;lt;&lt;/font&gt;&lt;font color=brown&gt;asp:DropDownList&lt;/font&gt; &lt;font color=red&gt;id&lt;/font&gt;&lt;font color=blue&gt;="ddlResponse"&lt;/font&gt; &lt;font color=red&gt;runat&lt;/font&gt;&lt;font color=blue&gt;="server"&lt;/font&gt;&lt;font color=blue&gt;/&amp;gt;&lt;/font&gt;
&lt;br&gt;
119&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=blue&gt;&amp;lt;&lt;/font&gt;&lt;font color=brown&gt;br&lt;/font&gt;&lt;font color=blue&gt;/&amp;gt;&lt;/font&gt;
&lt;br&gt;
120&amp;nbsp;&amp;nbsp;&lt;font color=blue&gt;&amp;lt;/&lt;/font&gt;&lt;font color=brown&gt;ItemTemplate&lt;/font&gt;&lt;font color=blue&gt;&amp;gt;&lt;/font&gt;
&lt;br&gt;
121&amp;nbsp;&lt;font color=blue&gt;&amp;lt;/&lt;/font&gt;&lt;font color=brown&gt;asp:Repeater&lt;/font&gt;&lt;font color=blue&gt;&amp;gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;font color=green&gt;// UsingDropDownLists.aspx.cs&lt;/font&gt;
&lt;br&gt;
211&amp;nbsp;&lt;font color=blue&gt;protected void&lt;/font&gt; rptOne_ItemCreated(&lt;font color=blue&gt;object&lt;/font&gt; sender,
RepeaterItemEventArgs e)&lt;br&gt;
212&amp;nbsp;{&lt;br&gt;
213&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=blue&gt;if&lt;/font&gt;(e.Item.DataItem != null)&lt;br&gt;
214&amp;nbsp;&amp;nbsp;&amp;nbsp;{ 
&lt;br&gt;
215&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyClass myClass = sender &lt;font color=blue&gt;as&lt;/font&gt; MyClass;&lt;br&gt;
216&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (e.Item.FindControl("litQuestion") &lt;font color=blue&gt;as&lt;/font&gt; Literal).Text
= myClass.Question;&lt;br&gt;
217&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DropDownList ddl = e.Item.FindControl("ddlResponse") &lt;font color=blue&gt;as&lt;/font&gt; DropDownList;&lt;br&gt;
218&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddl.DataSource = GetResponseList(myClass.AvailableResponses);&lt;br&gt;
219&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddl.Items.FindByValue(myClass.Response).Selected = &lt;font color=blue&gt;true&lt;/font&gt;;&lt;br&gt;
220&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddl.DataBind();&lt;br&gt;
221&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddl.SelectedIndex = e.Item.ItemIndex%(ddl.Items.Count-1); &lt;font color=darkgreen&gt;//Random&lt;/font&gt;
&lt;br&gt;
222&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
223&amp;nbsp;}&lt;/font&gt; &lt;/font&gt;&lt;/code&gt;
&lt;/p&gt;
Here is the sequence of events: 
&lt;ol&gt;
&lt;li&gt;
Page_Load 
&lt;li&gt;
Data Retrieval/Bind Data to Repeater 
&lt;li&gt;
Repeater's ItemCreated event fires for each RepeaterItem 
&lt;li&gt;
Data Retrieval/Bind Data to DropDownList 
&lt;li&gt;
OnDataBinding is fired from the DropDownList's DataBind() (line 220). However, if
you watch in debug mode, you will see that the DropDownList has no ListItems yet. 
&lt;li&gt;
DropDownList's SelectedIndex is chosen (line 221). Although, at this point, the DropDownList
still has no ListItems. The SelectedIndex call falls on deaf ears. 
&lt;li&gt;
RepeaterItem's DataBind method performs an actual DataBind on the DropDownList. There
are no selected items at this point. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
RepeaterItem inherits from Control. If you look at Control's DataBind() method in &lt;a href="http://www.aisto.com/roeder/dotnet/" target=_new&gt;Lutz
Roeder's .NET Reflector&lt;/a&gt;, you will see that it performs a DataBind on each of its
child controls.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;virtual&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; DataBind()&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;
this&lt;/span&gt;.OnDataBinding(EventArgs.Empty);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;
if&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;._controls
!&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)&lt;br&gt;
&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
string&lt;/span&gt; text1 &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;._controls.SetCollectionReadOnly(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Parent_collections_readonly"&lt;/span&gt;);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
int&lt;/span&gt; num1 &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;._controls.Count;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
for&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt; num2 &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 0;
num2 &amp;lt; num1; num2++)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this&lt;/span&gt;._controls[num2].DataBind();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
this&lt;/span&gt;._controls.SetCollectionReadOnly(text1);&lt;br&gt;
&amp;nbsp;&amp;nbsp; }&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
From this, we can see three things. 
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
The only safe time to choose the SelectedItem is after the binding of all objects
within the Repeater. A perfect place to do this is in the RepeaterItem's PreRender
or in the Repeater's PreRender. You have access to the same bound object from RepeaterItem.DataItem,
and can find the DropDownList and choose the SelectedIndex, SelectedValue, or ddl.Items.FindByValue(response).Selected
= true; 
&lt;li&gt;
The DataBind() call (line 220) is completely unnecessary and leads the programmer
to believe that it has actually bound the data. This is untrue. Again, in debug mode,
you will see that by line 221, there are still zero ListItems in ddl.Items. 
&lt;li&gt;
The same obstacle will arise for all Controls derived from ListControl. This includes
CheckBoxList, DropDownList, ListBox, and RadioButtonList. The same solution will apply
to these controls within a Repeater. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://offroadcoder.com/aggbug.ashx?id=6fc7ac74-39b7-480c-80d5-6f8b77fa66e4" /&gt;</description>
      <comments>http://offroadcoder.com/CommentView,guid,6fc7ac74-39b7-480c-80d5-6f8b77fa66e4.aspx</comments>
      <category>ASP.NET</category>
      <category>C#</category>
    </item>
  </channel>
</rss>