General discussion

Locked

Michael Freidgeim's Blog

By MNF ·
Tags: Off Topic
blog root

This conversation is currently closed to new comments.

17 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

OleDbException: Could not find file 'C:\WINNT\system32\ASWLocus'

by MNF In reply to Michael Freidgeim's Blog

I've got a strange error "OleDbException: Could not find file 'C:\WINNT\system32\ASWLocus'" when run SQL query for ACCESS database using <FONT size=1>System.Data.OleDb Data Provider in .Net code.<BR>It was strange because the database I've tried to access was in the different directory and name also was different-<BR>"C:\DataSamples\Locus.mdb"  I've checked that  it was specified correctly in the Connection String.<BR>The reason for the error was that I've used MS SQL Query Analiser to debug the SQL Query and referred to the Access Database as the Linked server  ASWLocus.<BR>I had FROM clause in the  SQL string <BR>" from ASWLocus...LD_MATTER as MATTER" <BR>and OleDb Data Provider interpreted ASWLocus as a reference to the external database and tried to find it.<BR>It makes sense, but it wasn't obvious when the error was reported.<BR></FONT><p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=93488#entryid">This post originally appeared on an external website</a></div>

Collapse -

Updated Web Site does not work until iisreset -happens more often since March 2005

by MNF In reply to Michael Freidgeim's Blog

I am using VS Web Setup Projects to update customer sites with new version of our application. For a long period it installed the web application without any problems and new version started to work immediately. <BR>Relatively recently (from beginning of March 2005) more and more sites experienced problems immediately after installation of the new version and iisreset is required (in some cases <A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=84560">uninstall and then re-install</A> is required).<BR>I do not blame changes in our installation, because the same .msi file was used since January till May on different sites and problems started to be noticed from March. Another issue with disabling Session State was reported also frm March. I suspect (not confirmed) that it is a result of  .NET Framework 1.1 Service Pack 1 installations.<p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=93576#entryid">This post originally appeared on an external website</a></div>

Collapse -

Configure Exchange Server 2003 for WebDav queries.

by MNF In reply to Michael Freidgeim's Blog

I have an ASP.NET application that use WebDav Queries to do full-text search in MS Exchange e-mail and public folders.<BR>The application was written and worked with Exchange 2000. Recently we replaced it with  Exchange 2003 (as a part of Small Business Server").<BR>When I tried to use the application against Exchange 2003, the following error was shown:<BR><FONT color=#ff0000><FONT size=1>System.Net.WebException: The remote server returned an error: (440) Login Timeout.<BR></FONT></FONT>I've tried to reproduce it on the development machine and the different error was shown:<BR><FONT color=#ff0000><FONT size=1>Could not establish trust relationship with remote server.</FONT><BR></FONT>Fortunately it was easily fixed by running Outlook Web Access and installing the exchange Server Certificate on the development machine.<BR>After this I was able to reproduce the same <FONT color=#ff0000 size=1>(440) Login Timeout</FONT> and after finding many links on Google<BR>the MS KB Article <A target="_blank" target="_blank" href="http://support.microsoft.com/default.aspx?kbid=817379" target=_blank>http://support.microsoft.com/default.aspx?kbid=</A><A target="_blank" target="_blank" href="http://support.microsoft.com/default.aspx?kbid=817379" target=_blank>817379</A> pointed to change <BR>settings of the Exchange virtual directory in Microsoft Internet Information Server (IIS).Exchange virtual directory was configured to accept only Secure Sockets Layer (SSL) connections.<BR>The next error was :<FONT color=#ff0000><FONT size=1> 501 (not implemented). </FONT><BR></FONT>I followed MS KB article  <A target="_blank" target="_blank" href="http://support.microsoft.com/?kbid=839744" target=_blank>http://support.microsoft.com/?kbid=839744</A> and re-create the Exadmin virtual server.<BR> The next error was:<FONT color=#ff0000 size=1>The remote server returned an error: (401) Unauthorized.<BR></FONT>Even i had changed Exchange virtual directory settings to enable Integrated Windows authentication accordong to <BR><A target="_blank" target="_blank" href="http://support.microsoft.com/default.aspx?kbid=817379" target=_blank> MS KB 817379</A> before, it was disabled  and  I had to re-enable it again. <BR>Hurray, no more errors but also no results back returned.<BR>Of course, I should to configure Full-Text Indexing as described in <A target="_blank" target="_blank" href="http://support.microsoft.com/default.aspx?scid=kb;en-us;822932" target=_blank pathAttribute="1">HOW TO: Configure Full-Text Indexing on Mailbox Stores in Exchange 2003</A>  <A target="_blank" target="_blank" href="http://www.kbalertz.com/kb_Q822932.aspx" pathAttribute="1">MS KB 822932</A>.<BR><SPAN id=_ctl1_lblComments>By the way, "How to Confirm That You Have Configured Full-Text Indexing Correctly" section of the article is not correct for Outlook 2003. I followed the instructions and received a valid list of messages back. However "Full-Text Index" wasn't created yet and WebDav full-text queries returned nothing. </SPAN> <BR>Ok, after a few hours of re-populating of the indexes the full-text search start to work for my account.<BR>But it still returned nothing for other user.<BR>After a fair number of attempts I found that "full text" search works only if in Outlook 2003 "Use cached Exchange Mode" is specified. I didn't find that it is documented somewhere.<BR>Now I can search e-mails, but for searching of public folders it returns "<FONT color=#ff0000>422 Unprocessable Entity</FONT>".<BR>It actually means that Full-Text Indexing is not enabled for public folders and I should repeat the same steps from <A target="_blank" target="_blank" href="http://www.kbalertz.com/kb_Q822932.aspx" pathAttribute="1">HOW TO: Configure Full-Text Indexing on Mailbox Stores in Exchange 2003</A>  but for  Public Folders.<BR><BR>Is it a good exersize to just make working application to work again?   <BR><p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=93600#entryid">This post originally appeared on an external website</a></div>

Collapse -

StringFromObject function to support conversion from Guid to String

by MNF In reply to Michael Freidgeim's Blog

I am having C# code converted from VB.net using Reflector and it's often uses <FONT color=#008000 size=2>StringType.FromObject</FONT>  to convert datarow column values to strings.<BR>Recently I've got the error <FONT color=#ff0000>"<FONT size=1>Cast from type 'Guid' to type 'String' is not valid." <BR><FONT color=#4e4d45>That's right, <FONT color=#008000 size=2>Microsoft.VisualBasic.CompilerServices.StringType.FromObject <FONT color=#4e4d45 size=1>doesn't handle <FONT size=2><STRONG>GUID</STRONG> <B>type.<BR></B>So I've created a helper function to extend  <FONT color=#008000>StringType.FromObject.<BR></FONT></FONT><FONT size=1>//using Microsoft.VisualBasic.CompilerServices;<BR>  public static string StringFromObject(object Value)<BR>  {<BR>   string sRet=null; <BR>   if (Value!=null) <BR>   {<BR>    //special case for Guid because is is not supported by Microsoft.VisualBasic.CompilerServices.StringType.FromObject <BR>    if (Value.GetType()==typeof(Guid))<BR>     sRet= Value.ToString(); <BR>    else<BR>     sRet=StringType.FromObject(Value);<BR>   }<BR>   return sRet;<BR>  }<BR></FONT></FONT></FONT></FONT></FONT></FONT><p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=93929#entryid">This post originally appeared on an external website</a></div>

Collapse -

Custom DataGrid Columns Edit control to support NewLine

by MNF In reply to Michael Freidgeim's Blog

Our ASP.NET application use  ASP.NET DataGrid control to allow in-line editing of the record. It uses text box Custom Columns developed using technique  described in <A target="_blank" target="_blank" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/creatingcustomcolumns.asp" pathAttribute="1">Creating Custom Columns for the ASP.NET Datagrid</A> article.<BR>However it was noticed that if value in the database is a string with NewLine characters, inline editing removes NewLine characters.<BR>To workaround this it is required to in the DataBinding function of the control<BR>check the value to show and change the type of the TextBox to "MultiLine" if required.<BR>            If oTextBox.Text.IndexOf(vbNewLine) >= 0 Then '            <BR>                oTextBox.TextMode = TextBoxMode.MultiLine<BR>            End If<BR>It solves the problem to keep new lines if they already exist in the field.<BR>By default the edit text box is shown as single line and it is acceptable for fcolumns, that usually expects text without new lines. For columns that are usually have newLine characters, textMode should be changed to  TextBoxMode.MultiLine unconditionally.  <p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=94391#entryid">This post originally appeared on an external website</a></div>

Collapse -

Determine Encoding of Wed Page in HtmlAgilityPack

by MNF In reply to Michael Freidgeim's Blog

I am using <A target="_blank" target="_blank" href="http://blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx" target=_blank pathAttribute="1">HtmlAgilityPack</A> to parse html and retrieve metadata from the web pages.<BR>Recently I noted that it doesn't correctly determine encoding of the web page.<BR>The reason is that <FONT size=2>HtmlAgilityPack.<FONT size=2>HtmlWeb.Get method checks only<FONT color=#808080> <FONT color=#008000 size=2>ContentEncoding <FONT color=#4e4d45>property which is extracted from http headers.<BR>Unfortunately not all web servers use the same header to specify target character set.<BR>The more accurate approach is described in <U><FONT color=#0000ff><A target="_blank" target="_blank" href="http://blogs.msdn.com/feroze_daud/archive/2004/03/30/104440.aspx" target=_blank pathAttribute="1">Feroze Daud's blog</A><BR></FONT></U>Also note that the code doesn't rely on HttpWebResponse.<A target="_blank" target="_blank" href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemnethttpwebresponseclasscharactersettopic.htm" target=_blank><U><FONT color=#0000ff>CharacterSet</FONT></U></A> property. the property seems almost never populated  correctly.<BR>I've created the new class based on  <A target="_blank" target="_blank" href="http://blogs.msdn.com/feroze_daud/archive/2004/03/30/104440.aspx" target=_blank pathAttribute="1">Feroze Daud's blog</A> post and changed the HtmlAgilityPack.<FONT size=2>HtmlWeb.Get method to use the new class.<BR></FONT>Update: <FONT color=#000000 size=2><A target="_blank" target="_blank" href="http://smourier.blogspot.com/" target=_blank pathAttribute="1">Simon Mourier</A> pointed me to existing method HtmlAgilityPack.HtmlDocument.DetectEncoding that simplifies the parse.</FONT><BR>This is <SPAN class=default><FONT face="Courier New">HttpResponseHelper class:<BR></FONT></SPAN><BR><SPAN class=html><SPAN class=keyword><SPAN class=html><SPAN class=default><FONT face="Courier New">using System</FONT></SPAN><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR></FONT></SPAN><SPAN class=default>using System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Text</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>RegularExpressions</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR></FONT></SPAN><SPAN class=default>using System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>IO</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR></FONT></SPAN><SPAN class=default>using System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Diagnostics </SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR></FONT></SPAN><SPAN class=default>using System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Net</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR></FONT></SPAN><SPAN class=default>using System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Collections</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Specialized</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR></FONT></SPAN><SPAN class=default>using HtmlAgilityPack</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR><BR></FONT></SPAN><SPAN class=default><FONT face="Courier New">namespace FSHelperLib <BR></FONT></SPAN><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>{ <BR>    </FONT></SPAN><SPAN class=default>using System</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>    </FONT></SPAN><SPAN class=default>using System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Text</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>    </FONT></SPAN><SPAN class=default>using System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Web</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR><BR>    </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>/// <summary> <BR>    /// Summary description for HttpResponseHelper. <BR>    /// </summary> <BR>    </FONT></SPAN><SPAN class=default>public </SPAN><SPAN class=keyword><FONT color=#1f1fcc>class </FONT></SPAN></FONT><SPAN class=default><FONT face="Courier New">HttpResponseHelper <BR>    </FONT></SPAN><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>{ <BR>        </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>// Methods <BR>        </FONT></SPAN><SPAN class=default>public HttpResponseHelper</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>() <BR>        { <BR>        } <BR>        </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>/// <summary> <BR>        /// Idea from http://blogs.msdn.com/feroze_daud/archive/2004/03/30/104440.aspx <BR>        /// If header ContentEncoding and CharacterSet are not specified use META HTTP-EQUIV <BR>        /// </summary> <BR>        /// <param name="resp">HttpWebResponse retrurned by req.GetResponse()</param> <BR>        /// <param name="strmMem">returns MemoryStream if it was populated when getting META HTTP-EQUIV <BR>        /// Parameter returns null if If the Content-Type header exists, and the value for this header contains a charset</param> <BR>        /// <returns>Detected Encoding or null</returns> <BR>        /// <remarks>Encoding can also be specified in the stream itself (using byte order mark)- not handled at the moment <BR>        ///</remarks> <BR>        </FONT></SPAN><SPAN class=default>public </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>Encoding DetectEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>HttpWebResponse resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>out MemoryStream strmMem</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc&gt <BR>        { <BR>            </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//bool bEncodingDefined=false; <BR>            </FONT></SPAN><SPAN class=default>strmMem</SPAN><SPAN class=keyword><FONT color=#1f1fcc>=</FONT></SPAN><SPAN class=default>null</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>            </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"The encoding method used is: " </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>ContentEncoding</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"The character set used is :" </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>CharacterSet</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            </FONT></SPAN><SPAN class=default>Encoding respenc </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>GetEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>ContentEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"ContentEncoding"</FONT></SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>); <BR>            </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//if(respenc==null)    respenc =GetEncoding(resp.CharacterSet ,"CharacterSet"); <BR>            </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>if(</FONT></SPAN><SPAN class=default>respenc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>==</FONT></SPAN><SPAN class=default>null</SPAN><SPAN class=keyword><FONT color=#1f1fcc&gt    </FONT></SPAN><SPAN class=default>respenc </SPAN><SPAN class=keyword><FONT color=#1f1fcc>=</FONT></SPAN><SPAN class=default>GetEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>GetCharsetFromContentType</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>),</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"CharsetFromContentType"</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            if(</FONT></SPAN><SPAN class=default>respenc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>==</FONT></SPAN><SPAN class=default>null</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt     <BR>            {     <BR>                </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>NameValueCollectionAsString</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Headers</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"response.Headers"</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>)) ; <BR>                </FONT></SPAN><SPAN class=default>respenc </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>GetEncodingFromMeta</SPAN><SPAN class=keyword><FONT color=#1f1fcc </FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>out strmMem</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            } <BR>            </FONT></SPAN><SPAN class=default>PrintEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>respenc</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            if(</FONT></SPAN><SPAN class=default>strmMem</SPAN><SPAN class=keyword><FONT color=#1f1fcc>!=</FONT></SPAN><SPAN class=default>null</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc&gt <BR>            {  </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//Points to the start of stream <BR>                </FONT></SPAN><SPAN class=default>strmMem</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Seek</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>0</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>SeekOrigin</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Begin</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            } <BR>            return </FONT></SPAN><SPAN class=default>respenc</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>        } <BR>        </FONT></SPAN><SPAN class=default>private  </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>Encoding GetEncodingFromMeta</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>WebResponse resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>out MemoryStream strmMem</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc&gt <BR>        { <BR>           </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>// save data to a memorystream <BR>            </FONT></SPAN><SPAN class=default>Stream rs </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>GetResponseStream</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>(); <BR>            </FONT></SPAN><SPAN class=default>strmMem </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>StreamCloneToMemory</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>rs</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            </FONT></SPAN><SPAN class=default>rs</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Close</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>(); <BR>            </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//Parse and retreive <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=??" /> <BR>            //Simon Mourier pointed me to existing method HtmlAgilityPack.HtmlDocument.DetectEncoding     <BR>            //it is more reliable than parse in http://blogs.msdn.com/feroze_daud/archive/2004/03/30/104440.aspx <BR>            </FONT></SPAN><SPAN class=default>HtmlAgilityPack</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>HtmlDocument doc </SPAN><SPAN class=keyword><FONT color=#1f1fcc>=new </FONT></SPAN><SPAN class=default>HtmlDocument</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>(); <BR>            </FONT></SPAN><SPAN class=default>System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Text</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Encoding enc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>=</FONT></SPAN><SPAN class=default>doc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>DetectEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>strmMem</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            return </FONT></SPAN><SPAN class=default>enc</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>        } <BR>        </FONT></SPAN><SPAN class=default>private </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>Encoding GetEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>string encodingName</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>string SourceFieldName</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>        { <BR>            </FONT></SPAN><SPAN class=default>Encoding respenc </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>null</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>            if(!</FONT></SPAN><SPAN class=default>IsNullOrEmpty</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>encodingName</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>)) <BR>            { <BR>                </FONT></SPAN><SPAN class=default><FONT face="Courier New">try <BR>                </FONT></SPAN><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>{ <BR>                    </FONT></SPAN><SPAN class=default>respenc </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>Encoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>GetEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>encodingName</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>); <BR>                    </FONT></SPAN><SPAN class=comment><FONT face="Courier New" color=#1f661f>//                    bEncodingDefined=true; <BR>                </FONT></SPAN><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>} <BR>                </FONT></SPAN><SPAN class=default>catch</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>Exception ee</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>                { <BR>                    </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"Exception: GetEncoding: " </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>SourceFieldName </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" = " </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>encodingName </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+</FONT></SPAN><SPAN class=default>Environment</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>NewLine </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>ee</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>ToString</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>()); <BR>                } <BR>            } <BR>            return </FONT></SPAN><SPAN class=default>respenc</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>        } <BR>        </FONT></SPAN><SPAN class=default>private </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>void PrintEncoding</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>System</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Text</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Encoding enc</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>        { <BR>            if(</FONT></SPAN><SPAN class=default>enc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>!=</FONT></SPAN><SPAN class=default>null</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>            { <BR>                </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Write</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" EncodingName=" </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>enc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>EncodingName</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Write</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" WebName =" </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>enc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WebName </SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Write</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" BodyName=" </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>enc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>BodyName</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Write</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" CodePage =" </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>enc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>CodePage </SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" HeaderName=" </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>enc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>HeaderName</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            } <BR>            else            </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine </SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" Encoding is null" </FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>        } <BR>        </FONT></SPAN><SPAN class=default>private  </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>string GetCharsetFromContentType</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>HttpWebResponse resp</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc&gt <BR>        {    </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//NOTE HttpWebResponse.CharacterSet property not alays returns a correct value <BR>            //because it also checks for some "MediaType" (see in Reflector) <BR>         <BR>            //  see if content length header has charset = value <BR>            // <BR>            </FONT></SPAN><SPAN class=default>String charset </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>null</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>            </FONT></SPAN><SPAN class=default>String ctype </SPAN><SPAN class=keyword><FONT color=#1f1fcc>=  </FONT></SPAN><SPAN class=default>resp</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>ContentType</SPAN><SPAN class=keyword><FONT color=#1f1fcc>;</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//  resp.Headers["content-type"];//resp.GetResponseHeader("Content-Type")) <BR>            </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"Content-Type= " </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>ctype</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt ; <BR><BR>            if(</FONT></SPAN><SPAN class=default>ctype </SPAN><SPAN class=keyword><FONT color=#1f1fcc>!= </FONT></SPAN><SPAN class=default>null</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>            { <BR>                </FONT></SPAN><SPAN class=default>int ind </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>ctype</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>IndexOf</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"charset="</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                if(</FONT></SPAN><SPAN class=default>ind </SPAN><SPAN class=keyword><FONT color=#1f1fcc>!= -</FONT></SPAN><SPAN class=default>1</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>                { <BR>                    </FONT></SPAN><SPAN class=default>charset </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>ctype</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Substring</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>ind </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>8</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                    </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>WriteLine</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"Content-Type: charset=" </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>charset</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                } <BR>            } <BR>            return </FONT></SPAN><SPAN class=default>charset </SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR>        } <BR></FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>/// <summary> <BR>/// Creates MemoryStream copy of stream provided <BR>/// </summary> <BR>/// <param name="rs">Source Stream will be positioned at the end when returned </param> <BR>/// <returns>MemoryStream copy of the source Stream, position at the beginning</returns> <BR>        </FONT></SPAN><SPAN class=default>private  </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>MemoryStream StreamCloneToMemory</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>Stream rs</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc&gt <BR>        { <BR>        </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>// save data to a memorystream <BR>            </FONT></SPAN><SPAN class=default>MemoryStream rawdata </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= new </FONT></SPAN><SPAN class=default>MemoryStream</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>(); <BR>            </FONT></SPAN><SPAN class=default>byte </SPAN><SPAN class=keyword><FONT color=#1f1fcc>[] </FONT></SPAN><SPAN class=default>buffer </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= new </FONT></SPAN><SPAN class=default>byte</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>1024</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>]; <BR>            </FONT></SPAN><SPAN class=default>int read </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>rs</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Read</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>buffer</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>0</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>buffer</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Length</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            while(</FONT></SPAN><SPAN class=default>read </SPAN><SPAN class=keyword><FONT color=#1f1fcc>> </FONT></SPAN><SPAN class=default>0</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>            { <BR>                </FONT></SPAN><SPAN class=default>rawdata</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Write</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>buffer</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>0</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>read</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>                </FONT></SPAN><SPAN class=default>read </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>rs</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Read</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>buffer</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>0</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>buffer</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Length</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            } <BR>            </FONT></SPAN><SPAN class=default>rawdata</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Seek</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>0</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>SeekOrigin</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Begin</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>); <BR>            return </FONT></SPAN><SPAN class=default>rawdata</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR>        } <BR><BR><BR>        </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>#region  FSHelperLib <BR>                 <BR>        //From TraceHelper <BR>        </FONT></SPAN><SPAN class=default>public </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>string NameValueCollectionAsString</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>NameValueCollection coll</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,  </FONT></SPAN><SPAN class=default>string sComment </SPAN><SPAN class=comment><FONT color=#1f661f>/* = "" */</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>        { <BR>            </FONT></SPAN><SPAN class=default>string sRet </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>""</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>            if (</FONT></SPAN><SPAN class=default>sComment</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Length </SPAN><SPAN class=keyword><FONT color=#1f1fcc>> </FONT></SPAN><SPAN class=default>0</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>            { <BR>                </FONT></SPAN><SPAN class=default>sRet </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+=  </FONT></SPAN><SPAN class=default>sComment</SPAN><SPAN class=keyword><FONT color=#1f1fcc>+</FONT></SPAN><SPAN class=default>Environment</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>NewLine </SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>            } <BR>            </FONT></SPAN><SPAN class=default>int loop1</SPAN><SPAN class=keyword><FONT color=#1f1fcc>, </FONT></SPAN><SPAN class=default>loop2</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR><BR>            </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>// Get names of all keys into a string array. <BR>            </FONT></SPAN><SPAN class=default>String</SPAN><SPAN class=keyword><FONT color=#1f1fcc>[] </FONT></SPAN><SPAN class=default>arr1 </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>coll</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>AllKeys</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>            for (</FONT></SPAN><SPAN class=default>loop1 </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>0</SPAN><SPAN class=keyword><FONT color=#1f1fcc>; </FONT></SPAN><SPAN class=default>loop1 </SPAN><SPAN class=keyword><FONT color=#1f1fcc </FONT></SPAN><SPAN class=default>arr1</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Length</SPAN><SPAN class=keyword><FONT color=#1f1fcc>; </FONT></SPAN><SPAN class=default>loop1</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>++) <BR>            { <BR>                </FONT></SPAN><SPAN class=default>sRet </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+=(</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"Key: " </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>arr1</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>loop1</SPAN><SPAN class=keyword><FONT color=#1f1fcc&gt );</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//+Environment.NewLine; <BR>                </FONT></SPAN><SPAN class=default>String</SPAN><SPAN class=keyword><FONT color=#1f1fcc>[] </FONT></SPAN><SPAN class=default>arr2</SPAN><SPAN class=keyword><FONT color=#1f1fcc>=</FONT></SPAN><SPAN class=default>coll</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>GetValues</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>arr1</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>loop1</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>]); <BR>                for (</FONT></SPAN><SPAN class=default>loop2 </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= </FONT></SPAN><SPAN class=default>0</SPAN><SPAN class=keyword><FONT color=#1f1fcc>; </FONT></SPAN><SPAN class=default>loop2 </SPAN><SPAN class=keyword><FONT color=#1f1fcc </FONT></SPAN><SPAN class=default>arr2</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Length</SPAN><SPAN class=keyword><FONT color=#1f1fcc>; </FONT></SPAN><SPAN class=default>loop2</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>++) <BR>                { <BR>                    </FONT></SPAN><SPAN class=default>sRet </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+=(</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>" Value " </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>loop2 </SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>": " </FONT></SPAN><SPAN class=keyword><FONT color=#1f1fcc>+ </FONT></SPAN><SPAN class=default>arr2</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>loop2</SPAN><SPAN class=keyword><FONT color=#1f1fcc&gt ) +</FONT></SPAN><SPAN class=default>Environment</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>NewLine</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>                } <BR>            } <BR>            return </FONT></SPAN><SPAN class=default>sRet</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>        } <BR>        </FONT></SPAN><SPAN class=default>public </SPAN><SPAN class=keyword><FONT color=#1f1fcc>static </FONT></SPAN><SPAN class=default>bool IsNullOrEmpty</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>string oItemValue</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>        { <BR>            </FONT></SPAN><SPAN class=default>bool bRet </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= ((</FONT></SPAN><SPAN class=default>oItemValue </SPAN><SPAN class=keyword><FONT color=#1f1fcc>== </FONT></SPAN><SPAN class=default>null</SPAN><SPAN class=keyword><FONT color=#1f1fcc>)||(</FONT></SPAN><SPAN class=default>oItemValue</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Length</SPAN><SPAN class=keyword><FONT color=#1f1fcc>==</FONT></SPAN><SPAN class=default>0</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>)); <BR>            return </FONT></SPAN><SPAN class=default>bRet</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR>        } <BR>        </FONT></SPAN><SPAN class=comment><FONT face="Courier New" color=#1f661f>#endregion  //FSHelperLib <BR><BR>    </FONT></SPAN><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>} <BR>} </FONT><BR></SPAN></SPAN><BR><BR><BR></SPAN></SPAN>The changes in the HtmlAgilityPack.<FONT size=2>HtmlWeb.Get method are in two places:<BR><BR>   //MNF 22/5/2005 begin changes<BR>   MemoryStream strmMem=null; //MNF 22/5/2005<BR>   respenc =FSHelperLib.HttpResponseHelper.DetectEncoding(resp,out strmMem);  <BR>//   if ((resp.ContentEncoding != null) && (resp.ContentEncoding.Length>0))<BR>//   {<BR>//    respenc = System.Text.Encoding.GetEncoding(resp.ContentEncoding);<BR>//   }<BR>//   else<BR>//   {<BR>//    respenc = null;<BR>//   }<BR>   //MNF 22/5/2005 end changes<BR><BR>and<BR><BR>   //MNF 22/5/2005 begin changes<BR>  Stream s= resp.GetResponseStream();<BR>   Stream s ;<BR>   if (strmMem==null)<BR>   {<BR>    s= resp.GetResponseStream();<BR>   }<BR>   else<BR>   {<BR>     s=strmMem;<BR>   }<BR>   //MNF 22/5/2005 end changes<BR><BR></FONT><BR><BR><BR><BR>  <BR></FONT></FONT></FONT></FONT></FONT>  <p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=95025#entryid">This post originally appeared on an external website</a></div>

Collapse -

Link to archived blog posts to make them searchable from Google

by MNF In reply to Michael Freidgeim's Blog

As I reported at the post
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top height=30><SPAN class=maintextheader><A target="_blank" target="_blank" href="/MessageBoard/MessageBoard_ViewThread.aspx?postid=3186" target=_blank>How to make archived blogs searchable from Google?</A></SPAN></TD></TR></TBODY></TABLE><SPAN class=maintext>Google search caches only the current Myblog.aspx <FONT color=#008000><FONT color=#4e4d45><FONT size=1>which is usually has only the last 7 entries.<BR> To help search engine to crawl the old posts I will manually  create links to my previous blog entries in March-April 2005.<BR></FONT><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=88954" target=_blank><FONT size=1>In MS Access assigning recordsource doesn't report errors.</FONT></A><FONT size=1> <BR><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=88687" target=_blank>NotSupportedException: The type System.Collections.IDictionary is not supported because it implements IDictionary.</A> <BR>
<TABLE id=Table2 style="TABLE-LAYOUT: fixed" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=maintextheader width=400><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=87642" target=_blank>Web Setup project fix to install on non-default Web Sites</A><BR><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=87459" target=_blank>Use of VBExpress.Net code generator</A> <BR><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=85287" target=_blank>Find datagrid item Cell by ID (name)</A> <BR><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=84990" target=_blank>.NET Framework 1.1 Service Pack 1 disables Session State?</A><BR>
<TABLE id=Table2 style="TABLE-LAYOUT: fixed" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=maintextheader width=400><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=84560" target=_blank>System.MissingMethodException with a strange "?" only</A> <BR>
<TABLE id=Table2 style="TABLE-LAYOUT: fixed" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=maintextheader width=400><A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=84553" target=_blank>The first entry</A> </TD></TR></TBODY></TABLE>Hopefully I (and others) will see the archived posts in Google soon.</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FONT></FONT></FONT></SPAN><p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=95429#entryid">This post originally appeared on an external website</a></div>

Collapse -

Show Print Dialog in MS Access ADE report.

by MNF In reply to Michael Freidgeim's Blog

Recently I've noticed that when user opens a report in the MS Access ADE application and use Print menu item from custom menu, the whole report is printed and no dialog box appears to selct printer and pages.<BR>There is an  <A target="_blank" target="_blank" href="http://techrepublic.com.com/5100-1035_11-1043739.html#" pathAttribute="1">TechRepublic article</A> how to customise menu to show dialog in Word, but unfortunately I didn't find a way to do the same in MS Access XP. It seems <A target="_blank" target="_blank" href="http://techrepublic.com.com/5208-6247-0.html?forumID=12&threadID=89766&messageID=732784" pathAttribute="1">not working in Access 2000 as well</A>.<BR>Fortunately if user has a report opened in Preview and clicks <FONT color=#005500><STRONG>Control-P</STRONG></FONT> the desired Print Dialog box is shown and user can select pages to print.<p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=95484#entryid">This post originally appeared on an external website</a></div>

Collapse -

Avoid (403) Forbidden errors when using HttpWebRequest

by MNF In reply to Michael Freidgeim's Blog

I had an error when tried to open the page <FONT color=#008000 size=2><A target="_blank" target="_blank" href="http://www.lycos.com/" target=_blank>http://www.lycos.com/</A></FONT> <SPAN class=maintext> using <A target="_blank" target="_blank" href="http://blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx" target=_blank pathAttribute="1"><U><FONT color=#800080>HtmlAgilityPack</FONT></U></A> from my ASP.NET application.<BR>The exception was <FONT color=#ff0000 size=1>System.Net.WebException: The underlying connection was closed: The server committed an HTTP protocol violation.</FONT><BR>When I tried to reproduce the problem using the test function <FONT size=2>GetLycosUrl</FONT> (see below) from WinForms application, it throwed the different <FONT color=#ff0000><FONT style="BACKGROUND-COLOR: #ffffff"</FONT><STRONG><FONT style="BACKGROUND-COLOR: #886800"><FONT style="BACKGROUND-COLOR: #ffffff">403) f</FONT></FONT>orbidden error</STRONG></FONT>. After some research I <A target="_blank" target="_blank" href="http://dotnetjunkies.com/WebLog/afontes/archive/2004/10/15/28726.aspx" pathAttribute="1">found</A> that <FONT color=#ff0000><FONT size=1> HTTP protocol violation  </FONT><FONT color=#4e4d45><FONT size=1>can be ignored, if you specify <STRONG>UseUnsafeHeaderParsing=true</STRONG> </FONT><FONT color=#000000 size=1>in the configuration file. HttpWebRequest.<STRONG>UseUnsafeHeaderParsing </STRONG> property is internal and read-only and can't be changed for particular instance of HttpWebRequest. <BR>It is also suprising that WinForms application does not raise </FONT></FONT><FONT size=1><FONT color=#ff0000>HTTP protocol violation </FONT><FONT color=#4e4d45>error even the debugger shows that </FONT></FONT><FONT color=#000000><FONT size=1><STRONG>UseUnsafeHeaderParsing </STRONG> =false.<BR>Now the question was why lycos send me back lycos send me back <FONT color=#ff0000<STRONG><FONT style="BACKGROUND-COLOR: #886800"><FONT style="BACKGROUND-COLOR: #ffffff">403) f</FONT></FONT>orbidden error.<BR></STRONG></FONT><FONT color=#4e4d45>With the help of <A target="_blank" target="_blank" href="http://www.fiddlertool.com/fiddler/" pathAttribute="1">Fiddler</A> I identified that the differense between IE and call from my application is <FONT size=2>UserAgent</FONT> header. If header will be provided, valid page will be returned from <STRONG><FONT size=2><FONT size=1>HttpWebRequest</FONT>.</FONT>GetResponse.<BR>To make  </STRONG><A target="_blank" target="_blank" href="http://blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx" target=_blank pathAttribute="1"><U><FONT color=#800080>HtmlAgilityPack</FONT></U></A> more robust the change in <FONT size=2>HtmlWeb.</FONT><FONT size=2>Get(Uri uri, </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> method, </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> path, HtmlDocument doc) is required.<BR></FONT><FONT face="Courier New">  </FONT><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//MNF 26/5/2005 Some web servers (e.g. http://www.lycos.com/) return 403 forbidden error unless UserAgent is specified <BR>  //so let's say it's IE6 <BR>  </FONT></SPAN><SPAN class=default>req</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>UserAgent</SPAN><SPAN class=keyword><FONT color=#1f1fcc>=</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)"</FONT></SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR>  </FONT></SPAN><SPAN class=comment><FONT face="Courier New" color=#1f661f>//alternatively  it can be changed in PreRequest event handler </FONT><BR></SPAN><BR>The function to test <FONT face="Courier New" color=#cc1f1f><A target="_blank" target="_blank" href="http://www.lycos.com">www.lycos.com</A> </FONT>url is the following:<BR><SPAN class=html><SPAN class=default><FONT face="Courier New">        </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//Add using to the top of file <BR>        //        using System.Net; <BR>        //        using System.Diagnostics; <BR>        </FONT></SPAN><SPAN class=default>private void GetLycosUrl</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>() <BR>        { <BR>            </FONT></SPAN><SPAN class=default>string url</SPAN><SPAN class=keyword><FONT color=#1f1fcc>=@</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"http://www.lycos.com/"</FONT></SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>; <BR>            </FONT></SPAN><SPAN class=default>HttpWebRequest request </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= (</FONT></SPAN><SPAN class=default>HttpWebRequest</SPAN><SPAN class=keyword><FONT color=#1f1fcc&gt </FONT></SPAN><SPAN class=default>WebRequest</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Create</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>url</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>); <BR>            </FONT></SPAN><FONT face="Courier New"><SPAN class=comment><FONT color=#1f661f>//the following line is critical, otherwise (403) forbidden error error will be returned <BR>            </FONT></SPAN><SPAN class=default>request</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>UserAgent</SPAN><SPAN class=keyword><FONT color=#1f1fcc>=</FONT></SPAN><SPAN class=string><FONT color=#cc1f1f>"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)"</FONT></SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR>            </FONT></SPAN><SPAN class=default><FONT face="Courier New">try <BR>            </FONT></SPAN><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>{ <BR>                </FONT></SPAN><SPAN class=default>HttpWebResponse response </SPAN><SPAN class=keyword><FONT color=#1f1fcc>= (</FONT></SPAN><SPAN class=default>HttpWebResponse</SPAN><SPAN class=keyword><FONT color=#1f1fcc&gt </FONT></SPAN><SPAN class=default>request</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>GetResponse</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>(); <BR>            } <BR>            </FONT></SPAN><SPAN class=default>catch </SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>Exception exc</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc&gt <BR>            { <BR>                </FONT></SPAN><SPAN class=default>Debug</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>Assert</SPAN><SPAN class=keyword><FONT color=#1f1fcc</FONT></SPAN><SPAN class=default>false</SPAN><SPAN class=keyword><FONT color=#1f1fcc>,</FONT></SPAN><SPAN class=default>exc</SPAN><SPAN class=keyword><FONT color=#1f1fcc>.</FONT></SPAN><SPAN class=default>ToString</SPAN></FONT><FONT face="Courier New"><SPAN class=keyword><FONT color=#1f1fcc>()); <BR>                </FONT></SPAN><SPAN class=default>throw</SPAN></FONT><SPAN class=keyword><FONT face="Courier New" color=#1f1fcc>; <BR>            } <BR>        } </FONT><BR></SPAN><SPAN class=default></SPAN></SPAN><BR></FONT></FONT></FONT></FONT></SPAN><p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=95486#entryid">This post originally appeared on an external website</a></div>

Collapse -

Extending Eric Woodruff's BP_funCheckForChanges JavaScript function to detect changes in ASP.NET web forms

by MNF In reply to Michael Freidgeim's Blog

I am using <A target="_blank" target="_blank" href="http://www.codeproject.com/script/profile/whos_who.asp?id=98184" target=_blank><U><FONT color=#0000ff>Eric Woodruff</FONT></U></A><STRONG> 's </STRONG><A target="_blank" target="_blank" href="http://www.codeproject.com/aspnet/EWSWebPt2.asp" target=_blank pathAttribute="1">ASP.NET Common Web Page Class Library</A><STRONG> </STRONG>to detect changes and prompt  user if any changes are not saved.<BR>There are a few modifications that I've done.<BR>Even if I found that <A target="_blank" target="_blank" href="MyBlog_Comments.aspx?ID=92144">using SmartNavigation is not a good idea</A> additional error handling in the JavaScript function BP_funCheckForChanges would not harm:<BR> <FONT face="Courier New" color=#000000>   var oForm = document.forms[BP_strFormName];<BR> try //MNF 4/8/2004 to avoid errors with SmartNavigation=true and page is moved away (eg Error message)<BR> { if (oForm.elements==null)<BR>      { //debugger;<BR>       return;<BR>   }<BR>    }<BR>    catch(err) <BR>    { <BR>      return;           <BR>    } <BR></FONT><BR>and<BR><FONT face="Courier New" color=#000000>   var ctlDirty = document.getElementsByName("BP_bIsDirty")[0];<BR> if (ctlDirty==null) return;//MNF 9/3/2005 to avoid errors with SmartNavigation=true and page is moved away <BR></FONT><BR>I also extended the code to support inline editing in DataGrid. It's also required that Save/Update button will have non-standard attribute BypassPrompt="true".<BR><BR><FONT style="BACKGROUND-COLOR: #000000" face="Courier New"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>//MNF 2/8/2004 added special case for datagrid buttons<BR>//document.activeElement.outerHTML "<A href=\"javascript:{if (typeof(Page_ClientValidate) != 'function' ||  Page_ClientValidate()) __doPostBack('_ctl1$grd$_ctl3$_ctl0','')} \"><BR>   if(document.activeElement)<BR>   {<BR>          var oElem = document.activeElement;<BR>          if (oElem.tagName=="A")<BR>          {  if(oElem.parentElement.tagName=="TD")<BR>             { if (oElem.children.length>0)<BR>      {   //Expected that Update image will have attribute BypassPrompt=="true"<BR>             if (oElem.children(0).BypassPrompt=="true") bPrompt = false;<BR>         }    <BR>             } <BR>          }<BR>   }<BR>//MNF 2/8/2004 end special case for datagrid buttons</FONT><BR></FONT><BR>Also I am using button's ClientIDs  to generate <FONT face="Courier New" color=#000000>BP_arrBypassList <FONT face=Verdana color=#4e4d45>and it causes problems if the button belongs to user control.To avoid the problem, the following code was added to the  <BR><FONT color=#000000>   if(strID != "")</FONT> block.<BR></FONT></FONT><BR><FONT face="Courier New" color=#000000>   //If submit button belongs to sub-control the strID is likely to have colon in the name "_ctl0:btnImportFromDatabase"<BR>   //But if BP_arrBypassList is generated using Control.ClientID, the separator is '_'<BR>   //We have to replace all ':'  to '_'<BR>   if (strID.indexOf(':') >= 0)<BR>      {<BR>            strID=strID.replace(':', '_');<BR>      }<BR></FONT><BR><BR><BR><BR><p><div class="blogdisclaim"><a href="http://www.thespoke.net/MyBlog/MNF/MyBlog.aspx?entryid=96593#entryid">This post originally appeared on an external website</a></div>

Back to After Hours Forum
17 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums