Microsoft KB Archive/816081

= How to Create Code for the ProfileRefresh Subroutine in Visual Basic .NET =

Article ID: 816081

Article Last Modified on 9/12/2003

-

APPLIES TO


 * Microsoft Commerce Server 2002 Standard Edition

-





For a Microsoft Visual C# .NET version of this article, see 815700.



SUMMARY
When you create a new Commerce Server Microsoft ASP.NET Web application in Microsoft Visual Basic .NET by using Microsoft Visual Studio .NET, the code that is generated does not contain all the code that is required for the ProfileRefresh subroutine to function correctly. Also, the documentation does not contain the information that you must have to write this code.



MORE INFORMATION
In the source code of the RefreshApp.aspx (RefreshApp.aspx.vb) file, the code that is generated causes the ProfileRefresh subroutine to fail. The following is the default code: Sub ProfileRefresh ' Implement Profile Service Refresh here ' Please see the Profile Service documentation for more information on       ' implementing a refresh of the Profile Service

' This will cause &quot;Publish failed&quot; to appear in the Business Desk application status Err.Raise(1) End Sub If you use the default Profiling System, you can replace the default code with the following code to provide valid ProfileRefresh functionality. To do this, follow these steps:   Add the following references to the code: Imports Microsoft.CommerceServer.Runtime Imports Microsoft.CommerceServer.Runtime.Profiles   Replace the existing code with the following sample code: Sub ProfileRefresh Dim profilesContext As ProfileContext Dim bdaoConnectionString As String Dim providerConnectionString As String Dim profilesConnectionString As String bdaoConnectionString = CommerceApplicationModule.Resources(&quot;Biz Data Service&quot;)(&quot;s_BizDataStoreConnectionString&quot;).ToString providerConnectionString = CommerceApplicationModule.Resources(&quot;Biz Data Service&quot;)(&quot;s_CommerceProviderConnectionString&quot;).ToString profilesConnectionString = CommerceApplicationModule.Resources(&quot;Biz Data Service&quot;)(&quot;s_ProfileServiceConnectionString&quot;).ToString profilesContext = New ProfileContext(profilesConnectionString, providerConnectionString, bdaoConnectionString, CommerceContext.Current.DebugContext) CommerceProfileModule.ProfileContext = profilesContext End Sub 

Keywords: kbhowto KB816081

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.