20.01.2015 Views

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

We are not going to go into all the compiler options in this book, but basically we've taken<br />

WebForm.aspx.vb and compiled it into a DLL named WebForm.dll and placed it in the<br />

application's /bin directory.<br />

If you need further help on compiling codebehind code please read the online ASP.NET<br />

help provided by Microsoft.<br />

In order for .NET to find your classes, make sure your compiled files are stored in the /bin<br />

directory off the root of your application. You need to make sure you've set your directory<br />

up as an IIS application or else ASP.NET will go up the tree until it finds one and end up<br />

at the /bin directory of the root application if it doesn't find one sooner.<br />

Once you have compiled the codebehind and made sure that the DLL file is located within<br />

the \bin directory within the root directory of your ASP.NET application, modify the<br />

page directive on the .aspx presentation page. Change the page directive from<br />

<br />

to:<br />

6.2.4. Planning<br />

<br />

You no longer need the Src attribute because the compiled codebehind file is located in the<br />

/bin directory. The compiled classes in the /bin directory are automatically available to use<br />

in all the ASP.NET pages in the application.<br />

When planning to create your own custom class codebehind files, even if they are just<br />

simple ones, you need to identify the controls and namespaces you will be utilizing so that<br />

you can correctly reference them in the Imports section of the file. In order to demonstrate<br />

this process, let's take a look at a sample codebehind file:<br />

6–14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!