Category Archives: Visual Basic

Enable ASP.NET AJAX v1.0 to your existing ASP.NET 2.0 Web Site or Web Application.

Few days ago, I shared about how to upgrade your ASP.NET 1.1 to ASP.NET 2.0, this time I am going to discuss about enabling ASP.NET AJAX v1.0 to your existing Web Site or Web Application.


1) You have to downlaod and install the ASP.NET 2.0 AJAX Extensions 1.0. Here
2) You may download and extract the ASP.NET AJAX Control Toolkit. Here


After install it, you will found out that you may create AJAX Enabled Web Application when creating new projects(Web Site or Web Application). You may also found out that there is a new tab called “AJAX Extensions” in Toolbox. If you have extracted the ASP.NET AJAX Control Toolkit, you may do the following,


1) Create new tab called “AJAX Control Toolkit”;
2) Right click under the created tab and click on “Choose Items…”;
3) Click “Browse…” and browse to the folder which you extract the ASP.NET AJAX Control Toolkit, and then browse to “~\SampleWebSite\Bin\” and select AjaxControlToolokit.dll
4) Now you will see a lot of controls which you are ready to use. You may browse and view the “Toolkit Live” to get the sample and idea on the controls.


You are now ready to build your AJAX web site or web application. However, if you have any existing ASP.NET 2.0 Web Site or Web Application, you do the normal action to write AJAX, you will found out that the AJAX is not working in your existing Web Site or Web Application. You have to do the following in order to let your existing ASP.NET 2.0 Web Site or Web Application to be “AJAX Enabled”,


1) Open web.config from your existing web site or web application
2) Add the following XML under <configuration> tab.

<configSections>
    <sectionGroup name=”system.web.extensions” type=”System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>
      <sectionGroup name=”scripting” type=”System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>
          <section name=”scriptResourceHandler” type=”System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication”/>
        <sectionGroup name=”webServices” type=”System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>
          <section name=”jsonSerialization” type=”System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”Everywhere” />
          <section name=”profileService” type=”System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” />
          <section name=”authenticationService” type=”System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <system.web>
    <pages>
      <controls>
        <add tagPrefix=”asp” namespace=”System.Web.UI” assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      </controls>
    </pages>
    <!–
          Set compilation debug=”true” to insert debugging
          symbols into the compiled page. Because this
          affects performance, set this value to true only
          during development.
    –>
    <compilation debug=”false”>
      <assemblies>
        <add assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      </assemblies>
    </compilation>

    <httpHandlers>
      <remove verb=”*” path=”*.asmx”/>
      <add verb=”*” path=”*.asmx” validate=”false” type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <add verb=”*” path=”*_AppService.axd” validate=”false” type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <add verb=”GET,HEAD” path=”ScriptResource.axd” type=”System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ validate=”false”/>
    </httpHandlers>

    <httpModules>
      <add name=”ScriptModule” type=”System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
    </httpModules>
  </system.web>

  <system.web.extensions>
    <scripting>
      <webServices>
      <!– Uncomment this line to customize maxJsonLength and add a custom converter –>
      <!–
      <jsonSerialization maxJsonLength=”500″>
        <converters>
          <add name=”ConvertMe” type=”Acme.SubAcme.ConvertMeTypeConverter”/>
        </converters>
      </jsonSerialization>
      –>
      <!– Uncomment this line to enable the authentication service. Include requireSSL=”true” if appropriate. –>
      <!–
        <authenticationService enabled=”true” requireSSL = “true|false”/>
      –>

      <!– Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
           writeAccessProperties attributes. –>
      <!–
      <profileService enabled=”true”
                      readAccessProperties=”propertyname1,propertyname2″
                      writeAccessProperties=”propertyname1,propertyname2″ />
      –>
      </webServices>
      <!–
      <scriptResourceHandler enableCompression=”true” enableCaching=”true” />
      –>
    </scripting>
  </system.web.extensions>

  <system.webServer>
    <validation validateIntegratedModeConfiguration=”false”/>
    <modules>
      <add name=”ScriptModule” preCondition=”integratedMode” type=”System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
    </modules>
    <handlers>
      <remove name=”WebServiceHandlerFactory-Integrated” />
      <add name=”ScriptHandlerFactory” verb=”*” path=”*.asmx” preCondition=”integratedMode”
           type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <add name=”ScriptHandlerFactoryAppServices” verb=”*” path=”*_AppService.axd” preCondition=”integratedMode”
           type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
      <add name=”ScriptResource” preCondition=”integratedMode” verb=”GET,HEAD” path=”ScriptResource.axd” type=”System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
    </handlers>
  </system.webServer>


Now you are ready to make your web site or web application to be “AJAX Enabled”.

Upgrading ASP.NET 1.x to ASP.NET 2.0

Last time, I speak in UserGroup gathering in 2007 Sept right after MSDN Seminar, the topic was “Experience Sharing: Upgrading ASP.NET 1.x –> 2.0 –> AJAX”. Well, I also promised that i will blog about it. Actually, it is nothing new and it is nothing special. I just shared my experience on how I upgrade ASP.NET 1.1 to 2.0 and how to enable AJAX.


First, I am not sure if you know that, in .NET framework 2.0, there is 2 types of Web Projects, ASP.NET 2.0 Web Site and ASP.NET 2.0 Web Application. You may refer to the following link for more information if you would like to read more.


Introduction to Web Application Projects
http://msdn2.microsoft.com/en-us/library/Aa730880(VS.80).aspx


If you are going to upgrading your existing ASP.NET 1.x project, you should choose to be using ASP.NET 2.0 Web Application project. This is the message from one of ScottGu’s blog, Tutorial on VB and C# are also mentioned.


“Because the VS 2005 Web Application Project model has the same conceptual semantics as the VS 2003 Web Project Model, it also makes migrating VS 2003 web projects very, very easy – with zero/minimal code changes required.  To learn how to automatically upgrade a VS 2003 web project using this option, please review these VB and C# tutorials that walkthrough the VS 2003 to VS 2005 upgrade process step-by-step.”


However, if you want to move your existing ASP.NET 2.0 Web Site to ASP.NET 2.0 Web Application, you may read the following message from ScottGu’s blog,


“If you want to migrate an existing VS 2005 Web Site Project to be a VS 2005 Web Application Project, please also review these other VB and C# migration tutorials that walkthrough the Web Site to Web Application conversion process step-by-step.  This article here also describes some of the differences between the VS 2005 Web Site Project Model and VS 2005 Web Application Project Model. “

 


Q: How can I create ASP.NET 2.0 Web Application Project?
A: Your machine must installed VS2005 with SP1 in order to create ASP.NET 2.0 Web Application Project


Q: I don’t want to install VS2005 SP1 at the moment, any other way?
A: you need the deprecated “Microsoft Visual Studio Web Application Projects” installer you can find it here.


Q: Anything I need to download if I am going to start developing in ASP.NET 2.0 Web Application Project?
A: Available as a separate download is a custom build tool for generating a strongly-typed Profile class for the ASP.NET 2.0 Profile system.  This allows you to right-click on a web.config file containing profile declarations and auto-generate the Profile type into your code-behind project assembly.  You can learn more about this and download it here. 


Q: I would like to read more and the full story on ScottGu blog.
A: Sure, you may go to ScottGu’s blog – VS 2005 Web Application Project V1.0 Released


Q: Any other resource from Microsoft Official link?
A: Sure, here you are, MSDN: Upgrade from ASP.NET 1.x


Q: You mentioned ASP.NET 2.0 to AJAX….
A: Yes, I am going to blog about it later on. Please come back some time for more detail.


 

Knowledge of language features, "Operator Overloading "

Well, I am one of the VB insiders, we are talking about a video. This video is a chatting video between 5 guys from difference team(VB, C#, C++, Channel 9 interviewer). They are going to answer you few question about the language future from their view when developing CLR/LINQ/VB/C#/C++. But the point we VB Insider discussing is, one of them, Brian Beckman has spoken that he likes C# because of the “Operator Overloading” support. That means he does not know that VB.NET(Or shorten called VB9 now) also has operator overloading support.


Another interesting issue I found afterward, I open up .NET Documentation, type the “operator overloading” keyword in Index Tab, I found a C# article(“Help me, I am overloaded”) on Operator Overloading and explain to you how to do so, why to do so(ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VSADD.v10.en/dncscol/html/csharp06212001.htm). But when I click in VB, it only shows you the “SAMPLE”(ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vbcode/html/30202e10-8bdc-47dc-8fd1-f0ff9ffa0641.htm). Oh…god…no article in VB? How the VB beginner learn and understand it then? No wonder why he said the above comment.






http://channel9.msdn.com/ShowPost.aspx?PostID=273697#273697

Anders Hejlsberg, Herb Sutter, Erik Meijer, Brian Beckman: Software Composability and the Future of Languages


Posted by Charles // Mon, Jan 22, 2007 1:09 PM

How will imperative programming languages evolve to suit the needs of developers in the age of Concurrency and Composability? What role can programming languages play in enabling true composability? What are the implications of LINQ on the furture of managed (CLS-based) and unmanaged(C++) languages? How will our imperative languages (static) become more functional (dynamic) in nature while preserving their static “experience” for developers? 

Answers to these questions and much more are to be found in this interview with some of Microsoft’s leading language designers and programming thought leaders: Anders Hejlsberg, Technical Fellow and Chief Architect of C#, Herb Sutter, Architect in the C++ language design group, Erik Meijer, Architect in both VB.Net and C# language design and programming language guru, and Brian Beckman, physicist and programming language architect working on VB.Net.

This is a great conversation with some of the industry’s most influential programming language designers. Tune in. You may be surprised by what you learn…

Windows Workflow Foundation(WF) Hands-On Lab01 to Lab03 in VB2005

If you are interesting in Windows Workflow Foundation(WF), you should found only C# hands-On Lab. A good news to you, I tried to translated them into VB2005, and it was tested by WF Team and now, you may download them from the following link, the full story are here…


I have 2 entries on the translation of WF, one is including Lab01, while another one is including Lab01-Lab03, they are both top 5 download in http://www.netfx3.com/


===========================================================


http://blogs.msdn.com/pandrew/archive/2006/12/02/Windows-Workflow-Foundation-and-Visual-Basic-.NET.aspx
The Windows Workflow Foundation (WF) runtime supports all CLS compliant programming languages. The Visual Studio 2005 extensions for WF are only provided for C# and Visual Basic .NET. It’s easy to find C# samples to get started. Here’s some pointers to samples for getting started with Windows Workflow Foundation in Visual Basic .NET.


Hands on Labs in VB.NETKen Lin has kindly translated these introductory WF HOLs to VB.NET


http://wf.netfx3.com/files/folders/documentation/entry7167.aspx (Lab01)


http://wf.netfx3.com/files/folders/documentation/entry7553.aspx (Lab01-Lab03)
.

Webclass on VB2005(in Cantonese)

I have recorded one webclass few months ago, it is about deploy VB2005 with ClickOnce. Althought this is nothing related to Vista, but I just want to share this with you, if you understand Cantonese, you may go and listen to it. Later on, I will do few more on Windows Workflow Foundation(WF), because I have writen few WF training guide, and it is now waiting approval to be post on MSDN site.


06novwebclass.JPG