Problem with inheritance of code behind page

  • Thread starter Thread starter John Morgan
  • Start date Start date
J

John Morgan

I am using Visual Studio with code behind to build files within an
application. The name of the project is bsecsSql.

Everything works fine on the local computer when I use 'copy project'
to copy it to a folder and use an address such as :
http://cms2/bsecsloc/management/electionPublic/candidateDetails.aspx

but when I upload it to an internet server and attempt to access a
page eg
http://www.bsecs.org.uk//management/electionPublic/candidateDetails.aspx:

I get the message
""Could not load type 'bsecsSQL.candidateDetails" with the following
line outlined in red as an error line

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="candidateDetails.aspx.vb"
Inherits="bsecsSQL.candidateDetails" Trace="true" %>

This is presumably because the address after 'Inherits' is
"bsecsSQL.candidateDetails". However I cannot get the page to work if
I merely put in
inherits"candidateDetails".

My question is how can ,I within or outside Visual Studio 2003,
configure the 'inherits' property so that it will work with the URL
shown above as well as on the local machine?

Best wishes, John Morgan
 
Hi,

Inherits set the name of the class that page compilation process use to
derive the class create from aspx declaration from. So Inherits got
nothing to do with path.

ASP.NET looks for this class in the DLL generate for pages code behind
classes. it looks like you didn't copy that DLL to the Bin directory. or
that classes use other assemblies that didn't load to the server.

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
John Morgan said:
I am using Visual Studio with code behind to build files within an
application. The name of the project is bsecsSql.

Everything works fine on the local computer when I use 'copy project'
to copy it to a folder and use an address such as :
http://cms2/bsecsloc/management/electionPublic/candidateDetails.aspx

but when I upload it to an internet server and attempt to access a
page eg
http://www.bsecs.org.uk//management/electionPublic/candidateDetails.aspx:

I get the message
""Could not load type 'bsecsSQL.candidateDetails" with the following
line outlined in red as an error line

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="candidateDetails.aspx.vb"
Inherits="bsecsSQL.candidateDetails" Trace="true" %>

This is presumably because the address after 'Inherits' is
"bsecsSQL.candidateDetails". However I cannot get the page to work if
I merely put in
inherits"candidateDetails".

My question is how can ,I within or outside Visual Studio 2003,
configure the 'inherits' property so that it will work with the URL
shown above as well as on the local machine?

John, I bet it wouldn't work even on another machine on your LAN. I don't
think it's a problem with the URL.

Where is the assembly containing bsecsSQL.candidateDetails? Did you put it
into the bin directory of the target server?

If you add a reference for that assembly, I think Copy Project will copy it
to the right place for you.
 
Thank you John and Natty for your help.

No, the bin directory was not in the bin directory of the target
server! Going on what you said I changed the location of the bin
directory from bsecs/management/ to bsecs/ , the target server and
this got things working together with moving global.asax into the root
bsecs folder.

I then decided to delete the'management' folder and copy the files
and folders of the project directly into the root bsecs folder and
this works OK.

However I think what I should have done is to add a reference in the
project properties as John was suggesting and I could then have used
my original folder configuration.

I really do appreciate the help I get from this forum,

Best wishes, John Morgan
 
Back
Top