My last entry (May 14, "THE SAGA CONTINUES") was written at the end of a hard day when I was frustrated, angry, tired, and on the verge of insanity. Therefore, upon reading again this morning, I realized that it probably wasn&#039;t very clear or to the point. For this reason I will attempt to describe the situation a little better.<BR><BR>I&#039;ve built a WebService contained in the file "DataAccessTest.asmx". It&#039;s namespace is "nsDataAccess". It contains a class, "DataAccess", which exposes a single method, "ShowData()". This method takes in two parameters, "ConnectionString" and "SQLQuery", both strings and both pretty self-explanatory. If zero-length strings are sent in, default values are used in their place.<BR><BR>The default ConnectionString value is obtained by calling a function, "GetDefaultConnectionString()". This function uses a HashTable object to grab the default string from the config.web file as shown below:<BR><BR>************************************ *************<BR>Private Function GetDefaultConnectionString() as String<BR>dim htAppSettings as HashTable = Context.GetConfig("appsettings")<BR>GetDefaultConn ectionString = htAppSettings("MyConnStrKey")<BR>End Function<BR>************************************** ***********<BR><BR>Once the ConnectionString value and SQLQuery value (whether they be default values or parameter values) are obtained, the function, "GetXMLResultSet()", is called. This function uses ADOConnection, ADOCommand, and ADOReader objects to get a resultset based upon the ConnectionString and SQLQuery values passed in. Once the resultset is obtained, an XML string is built, populated with the data obtained from the resultset, and then sent back to the calling function.<BR><BR>This XML string is what is returned by the "ShowData()" method of the "DataAccess" class.<BR><BR>Now, when I call this WebService up in my browser, it works beautifully. I can access its single method just fine to obtain the XML string. I can view its SDL. Everything is as it should be. However, when I try to access it from an ASP.NET page, I get errors.<BR><BR>I am using "Basic" authentication. The default connection string used by the WebService is: "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Parcel;Data Source=NTSQLASQL2KDEVL". In my config.web file, I have "impersonation" set to "true" and "authentication mode" set to "none". I am using a SQLServer2K remote database which sits on an NT box. My local box is a Win2K box.<BR><BR>In order to compile the WebService file into a proxy class/DLL using WebServiceUtil.exe, I&#039;ve had to change my authentication to "Anonymous"/"Integrated" and then change it back to "Basic" once I&#039;ve finished so I could view my files via my browser.<BR><BR>Having said all of that, here is one error that I receive when trying to pull up "dataaccess2.aspx" (which is the page that calls the ShowData() method from the WebService) in my browser:<BR><BR>---------------------------------------------<BR>You are not authorized to view this page<BR>...<BR>HTTP 401.2 - Unauthorized: Logon failed due to server configuration<BR>Internet Information Services<BR>...<BR>Background:<BR>This is usually caused by a server-side script not sending the proper WWW-Authenticate header field. Using Active Server Pages scripting this is done by using the AddHeader method of the Response object to request that the client use a certain authentication method to access the resource. <BR>---------------------------------------------<BR><BR>That&#039;s one error I get. Here&#039;s the piece of code, by the way, that calls the method of the WebService from the ASP.NET page:<BR><BR>************************************< BR>private function GetXMLString(byval sConnStr as string, byval sQueryStr as string) as string<BR>dim oDA as new DataAccess<BR>GetXMLString = oDA.ShowData(sConnStr, sQueryStr)<BR>end function<BR>************************************<B R><BR>The error mentioned above occurs at the line which says, "GetXMLString = oDA.ShowData(sConnStr, sQueryStr)". Now, in order to bypass this method call which is causing the error above, I have experimented by changing the code to look like the following"<BR><BR>******************************** ****<BR>private function GetXMLString(byval sConnStr as string, byval sQueryStr as string) as string<BR>&#039;dim oDA as new DataAccess<BR>&#039;GetXMLString = oDA.ShowData(sConnStr, sQueryStr)<BR>GetXMLString = "&#060;recs&#062;&#060;rec customerid=""TESTCUST"" companyname=""TestCo, Inc."" contactname=""Ima Kohntak"" contacttitle=""Minister of Defense"" /&#062;&#060;/recs&#062;"<BR>end function<BR>************************************<B R><BR>As can be seen in that code snippet, rather than trying to get the XML string from the WebService method, one is being created on the fly and sent back. When I do this, I get two results (interestingly enough). Either it works and the on-the-fly XML is displayed, or I get the following error:<BR><BR>-----------------------------------<BR>Could not load assembly &#039;genXX&#039;. Please make sure that your assemblies are placed in C:TonyTestsdotNETin or are globally accessible <BR>-----------------------------------<BR><BR>Note that &#039;genXX&#039; above appears as &#039;gen94&#039; or &#039;gen76&#039; or &#039;gen8b&#039; and other such combinations.<BR><BR>But the plot thickens.....I mentioned that sometimes I receive an error and sometimes I don&#039;t. I will now expound on that further. You will notice that in the last code snippet I included above, that I commented out the "dim oDA as new DataAccess" line. If I try to run the script that way, I may or may not recieve an error. The result remains the same if I refresh the browser screen after having loaded the page. That is to say, if I receive an error, the error remains no matter how many times I refresh the screen, as one would expect. Then, I uncomment it and may or may not receive an error. Again, the result remains upon refreshing the screen. What is so odd is that if I comment the line out once again, I could very recieve an error where before I did not - or I may not receive one. It&#039;s very unpredictable.<BR><BR>I don&#039;t know if any of this has really made a whole lot of sense to the reader without him actually being here to see the results. I hope that I have explained myself well. I am thoroughly confused as to why:<BR><BR>1) The exact same code will produce varying results.<BR>2) My WebService can access the SQLServer and work beautifully on its own, but I cannot call it from an ASP.NET page to do the same work.<BR><BR>If anyone has any suggestions or insight, please let me know.<BR><BR>I think that .NET has wonderful potential and can be very powerful for web development, but I am quickly becoming disenchanted with the lack of documentation and the unpredictable results I&#039;ve been experiencing. I hope these buggy issues get taken care of in the Beta 2 release and in future versions because I would very much like to use .NET 100% of the time - I am just getting a little frustrated with the Beta 1 version so far.<BR><BR>Again, any help would be greatly appreciated.<BR><BR>Thank you,<BR><BR>~~ Tony<BR><BR>P.S. Below are the two files mentioned in this entry. I apologize if wrapping makes it hard to read - it can be copied into some other text editor to be more easily read.<BR><BR>****************** dataaccesstest2.aspx ******************<BR>&#060;%@ Page Language="vb" Trace="false" %&#062;<BR>&#060;%@ Import NameSpace="System.XML" %&#062;<BR>&#060;%@ Import NameSpace="System.XML.XSL" %&#062;<BR>&#060;%@ Import NameSpace="System.IO" %&#062;<BR>&#060;%@ Import NameSpace="nsDataAccess" %&#062;<BR><BR>&#060;script language="vb" runat="server"&#062;<BR>private sub Page_Load(Sender as Object, E as EventArgs)<BR>dim sXML as string<BR>dim sTransformedOutput as string<BR>dim oXMLDoc as new XMLDocument<BR>dim oXSLT as new XSLTransform<BR>dim oDocNav as DocumentNavigator<BR>dim oStringWriter as new StringWriter<BR><BR>sXML = GetXMLString("", "")<BR>oXMLDoc.loadXML(sXML)<BR>oDocNav = new DocumentNavigator(oXMLDoc)<BR>oXSLT.load(Server.Ma pPath("MyTransformationDocument.xsl"))<BR>oXSLT.Tr ansform(oDocNav, nothing, oStringWriter)<BR>sTransformedOutput = oStringWriter.ToString<BR>oStringWriter.Close<BR> <BR>lblXML.text = sTransformedOutput<BR>end sub<BR><BR>private function GetXMLString(byval sConnStr as string, byval sQueryStr as string) as string<BR>dim oDA as new DataAccess<BR>GetXMLString = oDA.ShowData(sConnStr, sQueryStr)<BR>end function<BR>&#060;/script&#062;<BR><BR>&#060;html&#062;<BR>&#060;body &#062;<BR><BR>&#060;font face="arial" size="2"&#062;<BR>&#060;asp:label id="lblXML" text="" runat="server" /&#062;<BR>&#060;/font&#062;<BR><BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR>************************************ **********************<BR><BR>****************** DataAccess.asmx ******************<BR>&#060;%@ WebService Language="VB" Class="DataAccess"%&#062;<BR><BR>Imports System<BR>Imports System.Web.Services<BR>Imports System.Data<BR>Imports System.Data.ADO<BR>Imports System.Text<BR>Imports System.Collections<BR><BR>Public Class DataAccess : Inherits WebService<BR><BR>Public Function &#060;WebMethod()&#062; ShowData(ByVal ConnectionString As String, ByVal SQLQuery As String) As String<BR>dim sResult as String<BR>dim sbTemp as StringBuilder<BR>dim sDefaultConnStr as String = GetDefaultConnectionString()<BR>dim sDefaultQueryStr as String = "select top 50 * from table"<BR> <BR>&#039;Trim down the parameters passed in<BR>ConnectionString = ConnectionString.Trim<BR>SQLQuery = SQLQuery.Trim<BR> <BR>if (ConnectionString.Length &#062; 0) and (SQLQuery.Length &#062; 0) then<BR>&#039;Use both input parameters<BR>sResult = GetXMLResultSet(ConnectionString, SQLQuery)<BR>else<BR>if (ConnectionString.Length &#062; 0) and (not (SQLQuery.Length &#062; 0)) then<BR>&#039;Use the default query string<BR>sResult = GetXMLResultSet(ConnectionString, sDefaultQueryStr)<BR>elseif (SQLQuery.Length &#062; 0) and (not (ConnectionString.Length &#062; 0))<BR>&#039;Use the default connection string<BR>sResult = GetXMLResultSet(sDefaultConnStr, SQLQuery)<BR>elseif (not (ConnectionString.Length &#062; 0)) and (not (SQLQuery.Length &#062; 0))<BR>&#039;Use both defaults<BR>sResult = GetXMLResultSet(sDefaultConnStr, sDefaultQueryStr)<BR>end if<BR>end if<BR> <BR>sbTemp = new StringBuilder(sResult)<BR>sResult = sbTemp.Replace("&", "&amp;amp;").ToString()<BR> <BR>ShowData = sResult<BR>End Function<BR> <BR>Private Function GetXMLResultSet(byval sConnStr as String, byval sQueryStr as String) as String<BR>dim oConn as ADOConnection<BR>dim oCmd as ADOCommand<BR>dim oDR as ADODataReader<BR>dim sXML as String<BR> <BR>oConn = new ADOConnection(sConnStr)<BR>oCmd = new ADOCommand(sQueryStr, oConn)<BR>oConn.Open<BR>oCmd.Execute(oDR)<BR> <BR>sXML = "&#060;recs&#062;&#060;err msg="""" /&#062;"<BR>do while oDR.Read()<BR>sXML = sXML & "&#060;rec "<BR>dim i as Integer<BR>for i = 0 to (oDR.FieldCount - 1)<BR>&#039;Write the attribute names in lowercase<BR>sXML = sXML & oDR.GetName(i).Trim.ToLower() & "="<BR>if not oDR.IsNull(i) then<BR>sXML = sXML & """" & oDR.GetValue(i) & """ "<BR>else<BR>sXML = sXML & """"" "<BR>end if<BR>next<BR>sXML = sXML & "/&#062;"<BR>loop<BR>sXML = sXML & "&#060;/recs&#062;"<BR> <BR>oDR.Close<BR>oConn.Close<BR> <BR>GetXMLResultSet = sXML<BR>End Function<BR> <BR>Private Function GetDefaultConnectionString() as String<BR>dim htAppSettings as HashTable = Context.GetConfig("appsettings")<BR>GetDefaultConn ectionString = htAppSettings("MyConnStrKey")<BR>End Function<BR><BR>End Class<BR>***************************************** ************