The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
[Originally posted by tonyv]

I'm trying to run WebPok.aspx in my browser and keep getting a message that
basically tells me it doesn't recognize the type "Hand". I must have missed
something along the way. I don't understand how I get either WebPok.aspx or
WebPok.cs to recognize the Poker.dll without compiling via a command line
somehow. What am I missing or not understanding?

import-bot (20211) [Avatar] Offline
Re: WebPok
[Originally posted by tonyv]

Hello Fergal,

Here's a little better description of the error I get when trying to run
WebPok. Thanks again.

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'Hand' could not be
found (are you missing a using directive or an assembly reference?)

Source Error:

Line 11:
Line 12: protected void dealDrawHandler(object Source, EventArgs e) {
Line 13: Hand h;
Line 14: if (dealDrawButton.Text == "DEAL") {
Line 15:

Source File: C:My.NetCodewebwebpokWebPok.cs Line: 13
import-bot (20211) [Avatar] Offline
Re: WebPok
[Originally posted by fgrimes]

Hi Tony,
If you are running the downloaded source code you shouldn't have a problem.
Can you run other .aspx apps? Is poker.dll in the bin directory, etc.?
import-bot (20211) [Avatar] Offline
Re: WebPok
[Originally posted by tonyv]

Hello Fergal,

Thanks for getting back to me so soon. I'm not using the downloaded source
code. To get practice, I typed all the examples in. My code matches the book,
but I didn't think to compare it against the downloaded source code. The
Poker.dll is in the bin directory (I should say a bin directory that I created
to be a sub-directory to the application directory). I can run the other .aspx
examples that I typed from the book. It's just the last two exercises, WebPok
and ComPok, that I'm having trouble with. The only thing I can see that they
have in common is that they reference the Poker.dll. I used ildasm.exe to view
the Poker.dll in the bin directory and I do see the hand class. I'm gathering
from your reply that just having the Poker.dll in the bin directory is enough
for the WebPok app to get to the Hand class? I'll try the downloaded source
and let you know what happens. Thanks again..

P.S. - I learned quite a bit from your book. Thanks... For my own part, I
probably should have started with something a little more basic, but the good
news is that the ideas and concepts pertaining to .NET are no longer foreign
to me and I'm sure I'll get better with more practice!
import-bot (20211) [Avatar] Offline
Re: WebPok
[Originally posted by tonyv]

Hi Fergal,

I tried the downloaded source code and built the Poker.dll using the build.bat
file that was in the downloaded WebPok directory. I'm still getting the same
error. What outside of the code and the Poker.dll could cause this problem? My
path to my WebPok application is: "http://localhost/web/webpok". I can see the
webpok.cs and webpok.aspx in my virtual directory (webpok), and I can also see
the Poker.dll in the bin directory (which shows as a sub-directory of my
virtual directory). Are there settings in IIS that might cause this?, or
something in Internet Explorer? What can I send you to help me trouble-shoot
this problem?

Thanks again...
import-bot (20211) [Avatar] Offline
Re: WebPok
[Originally posted by fgrimes]

Hi Tony,

>> What outside of the code and the Poker.dll could
>> cause this problem?

The error message says that Hand is unrecognized. To be recognized, the
following conditions must be fulfilled:

- poker.dll must be compiled and placed in bin directory
- poker.dll must contain the Hand type
- both WebPok and Hand classes must be in the (same) poker namespace

I can think of nothing else, so please double-check these items, or ensure
that you are using downloaded versions of all files including WebPok.aspx,
WebPok.cs, and poker.dll.

To test poker.dll, copy ConPok.exe to the bin directory and run it from there.
Does it run OK?

Try placing WebPok in a different namespace by making the following edits:

insert at top of file: using Poker;
Change line 4: namespace Poker {
to : namespace TonyPoker {

insert at top of file: <%@ Import Namespace="Poker" %>

Now try running app. Do you get same error? Sorry I can't help further, but
this looks like a problem caused by a typo or some other corruption.