Page 139 - DCAP312_WEB_TECHNOLOGIES_II
P. 139

Unit 7: Advanced ASP.NET



            7.1.4 Browser Speak: A Concrete Example                                               Notes
            It has some real world use. Now time to put all this theory into practice and create a sample
            application that Browser Speak is a C# application that will speak the text on a web page out
            loud. It can be used when we are tired of reading large passages of text from the screen. It
            uses the System Speech Synthesis component found in the .NET Framework 3.0 for the text to
            speech functionality. Browser Speak provides the following commands, available through its
            web interface and through its UI.

               •  Speak Text
               •  Stop Speaking

               •  Pause Speaking
               •  Resume Speaking

            It also provides a Buffer Text command available from the web interface. This command is used
            to send a block of text from the web browser to the desktop application. It splits the text into 1500
            byte chunks so it is not limited by the maximum size of a URL. It is used by the Speak Selected
            bookmark let to transfer the selected text to the BrowserSpeak application prior to speaking.

            7.2 Web.Configuration


            Web.Config acts as a central position for storing the information to be accessed by web pages.
            This information could be an association String stored at a federal location so that it can be
            accessed in a data-driven page. If the connection string changes it is just a matter of changing
            it at one place.

            In classic ASP such global information was typically stored as an application variable. In the
            sample we will read the information from web configuration using ASP.NET and ASP as there
            could be a possibility of project having ASP and ASP.NET
            Web. Config
                     <?xml version=“1.0 “ encoding= “utf-8”?>
                     <configuration>
                     <appSettings>
                     <add key= “ConnectionString1” value= “server=localhost;uid=sa;pwd
                     =;database=northwind” />
                     <add key= “ConnectionString2” value= “server=localhost;uid=sa;pwd
                     =;database=pubs” />
                     </appSettings>
                     </configuration
            In ASP.NET
                     We can just using Configuration .App Settins (<key>) gives the Value.
                     (Name space: System. Configuration)

            VB.NET
                     Dim star Connection as String
                     Star Connection = Configuration Settings .App Settings( “ConnectionString1”)
                     Response.Write (star Connection)




                                             LOVELY PROFESSIONAL UNIVERSITY                                   133
   134   135   136   137   138   139   140   141   142   143   144