Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASPX & Codebehind in separate directories
Message
 
To
15/08/2002 11:11:09
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00689313
Message ID:
00690020
Views:
37
I assume you have tried the entire path like c:\inetpub\wwwroot\....

Put both src and codebehind attributes in the page header with the same information.

Make sure the codebehind file is compiled (manual compilation) before you try to open the aspx page. This must happen before VS can open the aspx page since it references a class. The class must exist first. VS.NET compiles this page first behind the scenes for us but in your case you need to manually do this.

>Cathi,
>
>I've also tried:
>
>//fchsdndev1/root//fchs/earlytrack/codebehind/admin/pages_security.vb
>
>with no success.
>
>I also tried to create a new form and saved it. I then moved the CB file up one directory and removed the original project reference to the CB file. I added the moved file to the project. When I changed the codebehind directive to ..\codebehind file name. No luck. I then moved the CB file back to the original directory and the directive to having no path, VS.Net still would not find it. The only way to find it again was to add it to the project again in the original directory. Is there something internal the VS.Net does to tie ASPX to CB files together?
>
>Any other ideas?
>
>Rex
>
>
>>Instead of using a relative path for the codebehind file, try changing it to the full path and see what happens. It might be getting confused about where to find the file.
>>
>>>Cathi,
>>>
>>>I changed the 'src' to Codebehind and get the following error:
>>>
>>>The class file '/fchs/earlytrack/codebehind/admin/pages_security.vb' specified as the codebehind for 'security_pages.aspx' could not be loaded. Make sure that the codebehind attribute is the page or control directive properly references an existing code behind file.
>>>
>>>The class file path and file name is correct, but VS.Net does not seem to be able to find the file.
>>>
>>>Is this a known problem with VS.Net?
>>>
>>>Any workarounds?
>>>
>>>TIA
>>>
>>>Rex
>>>
>>>>You have to compile (build) your project before viewing pages. That's why
>>>>you get that error.. it simply does not know where (or what) the base class
>>>>you're inheriting from is.
>>>>
>>>>Also, the first line of your header should look something like (you use the attribute "Codebehind" instead of "src"):
>>>>
>>>>
>>>>< % ERROR: @ Page Language="vb" AutoEventWireup="false" Codebehind="/fchs/earlytrack/codebehind/admin/pages_security.vb" Inherits="cb_pages_security" % >
>>>>
>>>>
>>>>>Jayesh,
>>>>>
>>>>>The class is defined as follows:
>>>>>
>>>>>
>>>>>Public Class cb_pages_security : Inherits Page
>>>>>
>>>>>
>>>>>Any ideas?
>>>>>
>>>>>TIA
>>>>>
>>>>>Rex
>>>>>
>>>>>>Is cb_pages_security derived from Page object?
>>>>>>
>>>>>>>All,
>>>>>>>
>>>>>>>I have been tasked with putting a .Net application under a project in VS.Net. The ASPX and codebehind files are located in separate directories and the ASPX files are pathed to the CB file as follows:
>>>>>>>
>>>>>>>
>>>>>>>< % ERROR: @ Page Inherits="cb_pages_security" src="/fchs/earlytrack/codebehind/admin/pages_security.vb" LANGUAGE="VB"  % >
>>>>>>>
>>>>>>>
>>>>>>>The error I get is:
>>>>>>>
>>>>>>>
>>>>>>>The file failed to load in the Web Form designer.  Please correct the following error, then load it again: Visual Studio cannot open a designer for the file because the class within it does not inherit from a class that can be visually designed.
>>>>>>>
>>>>>>>
>>>>>>>How can I fix this problem?
>>>>>>>
>>>>>>>TIA
>>>>>>>
>>>>>>>Rex
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform