Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 11th, 2012, 11:28 PM
Registered User
 
Join Date: May 2012
Posts: 14
Thanks: 3
Thanked 1 Time in 1 Post
Angry Can't get Bing SearchBox to work

I've got major problems.

I tried to add the Bing SearchBox to the site as described on page 344, but for some strange reason it blew up!

cs0103: the name 'bing' does not exist in the current context

So, I decided to installed the following Helper from the NuGet Package Manager:

ASP.NET Web Helpers Library 1.15

However, it appears that it doesn't exist anymore in NuGet. The only version available is:

ASP.NET Web Helpers Library 2.0.20505.1

When I install this one, my app blows up again! My database objects in DatabaseExtension.cs no longer work because namespace: WebMatrix.Data no longer exist in the newer version.

This is potentially a big problem, if the changes being made by Microsoft's developers, suddenly make libraries obsolete, then what's the point.

Is there an explanation for these issues I'm having, and what can be done to fix this?

Last edited by dejohnny; June 11th, 2012 at 11:53 PM.. Reason: errors
 
Old June 12th, 2012, 07:05 PM
Registered User
 
Join Date: May 2012
Posts: 14
Thanks: 3
Thanked 1 Time in 1 Post
Cool I found a solution to the problem

Quote:
This post is based on my own research, after spending many hours last night trying to get the code in chapter 12 to work.
If your PC received a Windows update lately (6/1/2012), you may not be able to run the Web Helpers that come with ASP.NET Web Helpers Library 1.15.

As of last week, the WebMatrix Team officially released WebMatrix, version 2. With it, core ASP.NET Web Pages assemblies and some Web Helper Libraries where also upgraded.

Therefore, some of the code you are trying to compile won't work. Not even Nuget via the ASP Web Pages Administration site.

Here's a Diff report showing the files in the Final Code download folder/Chapter 13 that were affected by this change. This File Diff report shows the differences between what worked for WebMatrix 1 and what now works in version 2. As you can see, there are some entries in the web.config file that weren't there before.

Compare C:\Documents and Settings\Darel Johnson\My Documents\Downloads\Final Code 050484\Final Code\Chapter13\Classifieds\bin with C:\Documents and Settings\Darel Johnson\My Documents\Downloads\Final Code 050484\Final Code\Chapter13\Classifieds_2.0\bin
6/12/2012 5:42:40 PM
Filename Folder Comparison result Left Date Right Date Extension
..
Microsoft.Web.Helpers.dll . Binary files are identical 7/15/2011 12:33:32 PM 7/15/2011 12:33:32 PM dll
Microsoft.Web.Infrastructure.dll . Binary files are identical 6/12/2012 1:01:22 PM 6/12/2012 1:01:22 PM dll
NuGet.Core.dll . Binary files are different 6/12/2012 1:01:22 PM * 6/12/2012 1:08:14 PM dll
System.Web.Helpers.dll . Binary files are different 6/12/2012 1:01:22 PM * 6/12/2012 1:08:14 PM dll
System.Web.Razor.dll . Binary files are different 6/12/2012 1:01:22 PM * 6/12/2012 1:08:14 PM dll
System.Web.WebPages.Administration.dll . Binary files are different 6/12/2012 1:01:22 PM * 6/12/2012 1:08:14 PM dll
System.Web.WebPages.Deployment.dll . Binary files are different 6/12/2012 1:01:22 PM * 6/12/2012 1:08:14 PM dll
System.Web.WebPages.dll . Binary files are different 6/12/2012 1:01:22 PM * 6/12/2012 1:08:14 PM dll
System.Web.WebPages.Razor.dll . Binary files are different 6/12/2012 1:01:22 PM * 6/12/2012 1:08:14 PM dll
WebMatrix.Data.dll . Binary files are different 6/12/2012 1:01:24 PM * 6/12/2012 1:08:17 PM dll
WebMatrix.WebData.dll . Binary files are different 6/12/2012 1:01:24 PM * 6/12/2012 1:08:17 PM dll

Compare C:\Documents and Settings\Darel Johnson\My Documents\Downloads\Final Code 050484\Final Code\Chapter13\Classifieds with C:\Documents and Settings\Darel Johnson\My Documents\Downloads\Final Code 050484\Final Code\Chapter13\Classifieds_2.0
6/12/2012 5:42:23 PM
Filename Folder Comparison result Left Date Right Date Extension
..
Account . 6/2/2012 4:53:05 PM * 6/12/2012 1:07:41 PM
Admin . 6/2/2012 4:53:05 PM * 6/12/2012 1:07:42 PM
App_Code . 6/2/2012 4:53:05 PM * 6/12/2012 1:07:42 PM
App_Data . 6/2/2012 4:53:05 PM * 6/12/2012 1:07:42 PM
bin . 6/12/2012 1:01:24 PM * 6/12/2012 1:08:17 PM
Content . 6/2/2012 4:53:06 PM * 6/12/2012 1:07:42 PM
Scripts . 6/2/2012 4:53:06 PM * 6/12/2012 1:07:42 PM
Shared . 6/2/2012 4:53:06 PM * 6/12/2012 1:07:42 PM
_AppStart.cshtml . Identical 7/5/2011 8:24:04 AM 7/5/2011 8:24:04 AM cshtml
_PageStart.cshtml . Identical 6/19/2011 8:51:32 PM 6/19/2011 8:51:32 PM cshtml
Default.cshtml . Identical 7/15/2011 12:36:38 PM 7/15/2011 12:36:38 PM cshtml
Details.cshtml . Identical 6/19/2011 9:13:58 PM 6/19/2011 9:13:58 PM cshtml
robots.txt . Identical 6/12/2012 1:01:25 PM 6/12/2012 1:01:25 PM txt
Sell.cshtml . Identical 7/15/2011 12:37:52 PM 7/15/2011 12:37:52 PM cshtml
Web.config . Files are different 6/12/2012 1:01:24 PM * 6/12/2012 1:08:17 PM config

Web.config
HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
        <specifiedPickupDirectory pickupDirectoryLocation="C:\Mail\" />
      </smtp>
    </mailSettings>
  </system.net>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="WebMatrix.WebData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
So, how did I fix my problem. Well it took several steps, and I'm going to outline them.

Make a copy of the old website project you had been working on and rename it to something else - like Classifieds 2.0 site. You are going to upgrade that project to work with Web Pages 2.0.

Delete the following folders from App_Data in Classifieds 2.0 site:
\Admin
\packages

Delete the \bin folder from the your new sites root folder. Right clicking on these folders and selecting the delete command should do the trick.



Getting WebMatrix 2:

Download WebMatrix 2 from the ASP.NET web site http://www.microsoft.com/web/webmatrix/

This will install the newest WebPlatform Installer 4.0 (WebPI) and WebMatrix 2. As of today, the newest download file is: webmatrix.3f.3f.3fnew.exe.

Install the software and install any dependencies the installer reports in the installation summary. The installation may take a while to finish, so making a cup of Tea would make a nice break.

Now the next step is crucial. The site project you want to upgrade must have the older ASP.NET Web Helpers Library 1.15 installed. Meaning you must go back to the old Classifieds site and copy the files from the following folders to the new site.

Copy:
\Admin
\packages\

to the \App_Data folder in you new Classifieds 2.0 site. Also copy the \bin folder as well.

Once you've copied the folders and completed the WebMatrix 2 installation, go ahead and launch the application.

On the WebMatrix 2s main splash screen, click on Open Site. You should see a menu pop up from there. Now you're going to import your site that you copied earlier into WebMatrix 2. Choose Folder as Site and browse your PCs harddrive folders and find the site folder you want to import. Click Open to start the import. At this point you should be in the Site Workspace.

Click on the File Workspace. You should see your new Classifieds site created with a copy of your website files and the \bin folder and the \Admin and packages folder in App_Data. Select the sites root folder at the top -- Classifieds 2.0. Next try to run the site. At some point, you should see a dialog box pop up asking you if you want to open the Site as Web Pages 1.0 site, or if you want to upgrade your site to Web Pages 2.0.

Choose to upgrade your site to Web Pages 2.0. If that doesn't work, go back to the Site Workspace and change the ASP.NET Web Pages Version to v2.0.20505.0.

My problem is now solved.

Last edited by dejohnny; June 13th, 2012 at 08:13 AM.. Reason: errors





Similar Threads
Thread Thread Starter Forum Replies Last Post
SMS API does not work online but work fine offline. Tonik Beginning PHP 1 January 4th, 2013 08:30 AM
Chapter 1 Ctrl+F5 don't work, F5 does work? jimboak BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 June 29th, 2008 03:46 AM
why it doesn't work sangfroid C# 2005 2 January 21st, 2008 02:38 PM
Can't get the first example to work MikeH JSP Basics 1 July 22nd, 2005 03:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.