Confused Using VB in VS2003

W

Wayne Wengert

I have an ASP.NET (VB) Web Application developed in VS2003. I am totally
confused on what needs to get copied to the Web Host when I make some
changes. Most of the forms are aspx pages and include a codebehind file
(e.g. myform.aspx and myform.aspx.vb) Normally I do a project rebuild and
then a Copy Project with FrontPage option and only required files and then
FTP those files. That is a lot of files. If I make a change to the VB code
in just one file (e.g. myform.aspx.vb) exactly what needs to be done to get
that change on the host without copying unchanged files?

Wayne
 
G

Guest

Wayne,

If you only changed something in the code behind you should only
need to copy the dll to the web server.

Ken
 
W

Wayne Wengert

OK, I'll try that next time. When do I have to copy the myform.aspx.vb page
out there?

Wayne
 
C

Cor Ligthert [MVP]

Wayne,

As Ken already said, you only need your DLL to copy, (the best in a by
settings save placed directory as bin). Your .vb or .cs pages should in
normal situations never be copied to your webserver and don't have to be
there.

I hope this helps,

Cor
 
W

Wayne Wengert

Thanks for the reply, but when the .vb pages are not out there, I get errors
that it can't find the .vb file?

Wayne
 
C

Cerebrus

Hi Wayne,

There is a conceptual issue you need to understand, here. There are two
ways of compiling your pages :

1. Without Precompilation :
------------------------------------------
In this method, your .aspx page and your code-behind file(.vb or .cs)
reside on the web
server. When a client requests your .aspx page, ASP.NET compiles both
the .aspx and the
code-behind file, into .dll files.

In this method, your .aspx is linked to your .vb file using the "src"
attribute of the Page
directive, which points to the .vb file.

2. With Precompilation :
-----------------------------------
This is the preferred method, since you don't have to distribute your
Code-behind file to
the web server. There are also other advantages. And this is the method
that Cor and
Ken are suggesting you should use.

In this method, only your .aspx page resides on the web server
initially. You can then
compile your .vb into a .dll manually using the "vbc.exe" command line
compiler. This will
generate your code-behind .dll. Now you need to do two things :
a) Copy this .dll to the bin directory in the application folder on the
webserver.
b) Remove the "src" attribute of the Page directive in your .aspx file.
Make sure

"Inherits" points to the fully qualified class name of your Code-behind
file.
Now, when a client requests your .aspx page, ASP.NET will compile only
1 file, that is your
..aspx file, but while doing this, it will include references to the
..dll file placed in the bin
sub-directory.

So, this method is much easier for maintenance.

Hope I was able to explain it in lucid terms,

Regards,

Cerebrus.
 
W

Wayne Wengert

Thank you very much for that informative response. I actually think I
understand some of what is going on here (an accomplishment for an old duck
like me!). I will save your instructions and see if I can't get better
control of my web pages.

Wayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top