By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,133 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,133 IT Pros & Developers. It's quick & easy.

Global subroutines

P: n/a
Hi Tom !

Sorry about the messy quoting, Google is playing tricks on me at the
moment.
Global.asax is where you normally have the Global Application
and Session variables and code to manipulate them. It starts
and ends with <script></script> tags.

Yours looks like a compiled version of it.

It is just like any ASP.net page. If you use code-inside, you
surround the code with the script tags. To make the code into
a code-behind file, you move the code to a new file and leave
out the script tags.
I had never thought of it that way. I'm not saying you're wrong, to be
honest I'm not at all sure, but :
1) I've searched hi and lo and can't find anything resembling script
tags in Global.asax.
2) There has to be a Global shared (static) class, because that's
where the variables are held.
3) In VS, contrarily to plain aspx pages, you don't have access to
HTML code for Global.asax (usually, an aspx combo has three different
views : the html view and the design view, which are two tabs on the
same window, and the code-behind file which sits in another window.
There's no design or html tab in Global.asax.
4) As far as I know, aspx stands for Active Server Page eXtended(?),
asax stands for Active Server Application eXtended(?). It's supposed
to be an app, not an page as such. You cannot, for instance, drop a
html table on Global.asax, but mind you, you can drop Windows Forms
controls on it !!

So, I do believe it's not an aspx but a proper app, contained in a
class, and not enclosed in a script block. Again, I could be wrong. I
wish some guru would help us there.
To have a class, I think you would need to compile the file, as you said
and you would have to have the codebehind/inherits on all my pages. I am
trying to get around this.
You definitely need to compile the file in any case. Compiling it
creates a dll in a bin directory, without which no aspx page can be
served (plain html can, though, but that's IIS working under the
scene). You don't have to inherit it on any page, because the
structure is as follows :

Global.asax inherits from the System.Web.HttpApplication class and is
inside the namespace that's named after your project. As it is shared,
it can be used from any other object that is inside that namespace, so
any page inside that namespace can refer to Global.asax simply by
using, for instance, "Global.SomeMethod" (provided that method is
public, obviously).
Pages inherit from System.Web.Ui class. They don't need to inherit
from the application itself (read : they musn't).
Each page has an associated code-behind file, and the aspx file
inherits from the class that lies in the code-behind file. With VS,
all this is totally transparent and taken care for you by the
Framework.
The other problem is - how would I handle 2 codebehind files. Each
aspx page would have it's own code behind and then you have the
Global one. How would you set that up in your ASP pages (you would
need 2 inherits and 2 codebehind statements).
You don't. Again, I think your misconception comes from the fact that
you think the app is not compiled. Think of it this way : the app
contains many classes, some being pages, some being code-behind files,
and one being the Global object. All these classes can (theoretically)
talk to each other, and that's why, to return to the beginning of your
question, you can include shared methods in the Global class and use
them from other classes (code-behind files).
I did that last night, as you suggested, and just have to wait for the CD.


Well, that's very good news for you, because I'm positive that it'll
all become clear very quickly, and I'm also quite sure that you'll
have tremendous fun. VS is the best toy I ever dreamed of, it's fast,
deep, smart, coherent and has the most impressive optimisations. In a
month and a half, I've developped a program that used to cost around
100.000 $ five years ago. I'm in no way affiliated blah blah,
obviously.

So, have fun with it !

Michel
Nov 19 '05 #1
Share this Question
Share on Google+
22 Replies


P: n/a
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom !

Sorry about the messy quoting, Google is playing tricks on me at the
moment.
Global.asax is where you normally have the Global Application
and Session variables and code to manipulate them. It starts
and ends with <script></script> tags.

Yours looks like a compiled version of it.

It is just like any ASP.net page. If you use code-inside, you
surround the code with the script tags. To make the code into
a code-behind file, you move the code to a new file and leave
out the script tags.
I had never thought of it that way. I'm not saying you're wrong, to be
honest I'm not at all sure, but :
1) I've searched hi and lo and can't find anything resembling script
tags in Global.asax.
2) There has to be a Global shared (static) class, because that's
where the variables are held.
3) In VS, contrarily to plain aspx pages, you don't have access to
HTML code for Global.asax (usually, an aspx combo has three different
views : the html view and the design view, which are two tabs on the
same window, and the code-behind file which sits in another window.
There's no design or html tab in Global.asax.
4) As far as I know, aspx stands for Active Server Page eXtended(?),
asax stands for Active Server Application eXtended(?). It's supposed
to be an app, not an page as such. You cannot, for instance, drop a
html table on Global.asax, but mind you, you can drop Windows Forms
controls on it !!

So, I do believe it's not an aspx but a proper app, contained in a
class, and not enclosed in a script block. Again, I could be wrong. I
wish some guru would help us there.


You may be correct.

I know the Global.asax has script tags (only because that was the way the
example program I used a while ago had it set up). In the books I have,
such as "ASP.net: Tips, Tutorials and Code" - it shows it with the script
tags.

Maybe it doesn't matter. Maybe .net just throws it away. I assume that if
you don't have script tags in yours and I do in mine, it isn't an issue with
..net.
To have a class, I think you would need to compile the file, as you said
and you would have to have the codebehind/inherits on all my pages. I am
trying to get around this.
You definitely need to compile the file in any case. Compiling it
creates a dll in a bin directory, without which no aspx page can be
served (plain html can, though, but that's IIS working under the
scene). You don't have to inherit it on any page, because the
structure is as follows :

Global.asax inherits from the System.Web.HttpApplication class and is
inside the namespace that's named after your project. As it is shared,
it can be used from any other object that is inside that namespace, so
any page inside that namespace can refer to Global.asax simply by
using, for instance, "Global.SomeMethod" (provided that method is
public, obviously).
Pages inherit from System.Web.Ui class. They don't need to inherit
from the application itself (read : they musn't).
Each page has an associated code-behind file, and the aspx file
inherits from the class that lies in the code-behind file. With VS,
all this is totally transparent and taken care for you by the
Framework.


So if I compile it, would I end up with Global.dll?

With a regular code behind, I would compile it like so:

vbc /t:library something.vb

This would give me something.dll.

Would I compile the Global.asax something like:

vbc /t:library Global.asax

To get get Global.dll

Or would I need to name it Global.asax.vb and do:

vbc /t:library Global.dll
The other problem is - how would I handle 2 codebehind files. Each
aspx page would have it's own code behind and then you have the
Global one. How would you set that up in your ASP pages (you would
need 2 inherits and 2 codebehind statements).


You don't. Again, I think your misconception comes from the fact that
you think the app is not compiled. Think of it this way : the app
contains many classes, some being pages, some being code-behind files,
and one being the Global object. All these classes can (theoretically)
talk to each other, and that's why, to return to the beginning of your
question, you can include shared methods in the Global class and use
them from other classes (code-behind files).
I did that last night, as you suggested, and just have to wait for the
CD.


Well, that's very good news for you, because I'm positive that it'll
all become clear very quickly, and I'm also quite sure that you'll
have tremendous fun. VS is the best toy I ever dreamed of, it's fast,
deep, smart, coherent and has the most impressive optimisations. In a
month and a half, I've developped a program that used to cost around
100.000 $ five years ago. I'm in no way affiliated blah blah,
obviously.


Should be here soon.

Thanks,

Tom So, have fun with it !

Michel

Nov 19 '05 #2

P: n/a
Hi Tom !
I know the Global.asax has script tags (only because that was the way the
example program I used a while ago had it set up). In the books I have,
such as "ASP.net: Tips, Tutorials and Code" - it shows it with the script
tags.

Maybe it doesn't matter. Maybe .net just throws it away. I assume that if
you don't have script tags in yours and I do in mine, it isn't an issue with
.net.
OK, I think I understand now. I opened the Global.asax file with
Notepad, and I have this (and only this):

<%@ Application Codebehind="Global.asax.cs"
Inherits="myNamespace.Global" %>

When I open an aspx page, I get this:

<%@ Page language="c#" Codebehind="myPage.aspx.cs"
AutoEventWireup="false" Inherits="myNamespace.myPage" %>

So, it is indeed a place where you *can* put script tags. But the
architecture of Visual Studio makes it so you don't. Note the
directives : Global is an "Application" and pages are "Page"; and the
App has no language specified.
So if I compile it, would I end up with Global.dll?
With a regular code behind, I would compile it like so:
vbc /t:library something.vb
This would give me something.dll.

Would I compile the Global.asax something like:
vbc /t:library Global.asax
To get get Global.dll
Or would I need to name it Global.asax.vb and do:
vbc /t:library Global.dll


Ouch. The problem is, I have never tried to compile anything out of
VS, because it does it automatically (fairly complex site with 30+
auto-configuring pages, 10 databases: 1 keystroke, 2 seconds). But it
doesn't compile as Global.dll, the whole thing is compiled into one
"myNamespace.dll": all page code-behinds, all classes, Global, all
User Control code-behinds, the works.

So I wouldn't know about the switches. Definitely, this has to do with
Namespaces. It should be compiled as a library, that's for sure, but I
don't know how you go about it. My first guess would be something
like:

vbc /t:library Global.asax.vb myFirstPage.vb mySecondPage.vb
out:myNamespace.dll

If I were you, I'd try this : create one Global.asax containing the
line mentioned above. Create one Global.asax.vb containing :

Imports System.Web
Imports System.Web.SessionState

Public Class Global
Inherits System.Web.HttpApplication

Public Sub New()
MyBase.New()
InitializeComponent()
End Sub

Private components As System.ComponentModel.IContainer

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container()
End Sub

Public Test() as String
Return "hello";
End Sub
End Class

Create one "TestPage.aspx" containing :

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="TestPage.aspx.vb" Inherits="myNamespace.TestPage"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>test</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server"></asp:Label>
</form>
</body>
</HTML>

And finally, one TestPage.vb containing:

Public Class TestPage
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Label1.Text = Global.Test
End Sub
End Class

(watch the line feeds)

Then, compile it (unfortunately, I can't help you there) and try
http://localhost/myNamespace/TestPage.aspx.

You might need a Web.config file. If it's the case and you can't wait
for your VS to arrive, just say so and I'll give you a generic one.
But with all this, you should have a proper web app (provided you have
declared your app as a folder in IIS) and a working test page calling
a global routine in the Global class (phew!).

If you manage all this without VS, then I'm in awe.

Another thought : maybe it could help you if I sent you a "blank"
project, containing everything, the project files, the test page and
the global files? If so, just give me your mail adress (don't forget
to put nospam bs in it) and I'll send it to you.

Best of luck !

Michel
Nov 19 '05 #3

P: n/a
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom !
I know the Global.asax has script tags (only because that was the way the
example program I used a while ago had it set up). In the books I have,
such as "ASP.net: Tips, Tutorials and Code" - it shows it with the script
tags.

Maybe it doesn't matter. Maybe .net just throws it away. I assume that
if
you don't have script tags in yours and I do in mine, it isn't an issue
with
.net.
OK, I think I understand now. I opened the Global.asax file with
Notepad, and I have this (and only this):

<%@ Application Codebehind="Global.asax.cs"
Inherits="myNamespace.Global" %>

When I open an aspx page, I get this:

<%@ Page language="c#" Codebehind="myPage.aspx.cs"
AutoEventWireup="false" Inherits="myNamespace.myPage" %>

So, it is indeed a place where you *can* put script tags. But the
architecture of Visual Studio makes it so you don't. Note the
directives : Global is an "Application" and pages are "Page"; and the
App has no language specified.
So if I compile it, would I end up with Global.dll?
With a regular code behind, I would compile it like so:
vbc /t:library something.vb
This would give me something.dll.

Would I compile the Global.asax something like:
vbc /t:library Global.asax
To get get Global.dll
Or would I need to name it Global.asax.vb and do:
vbc /t:library Global.dll


Ouch. The problem is, I have never tried to compile anything out of
VS, because it does it automatically (fairly complex site with 30+
auto-configuring pages, 10 databases: 1 keystroke, 2 seconds). But it
doesn't compile as Global.dll, the whole thing is compiled into one
"myNamespace.dll": all page code-behinds, all classes, Global, all
User Control code-behinds, the works.

So I wouldn't know about the switches. Definitely, this has to do with
Namespaces. It should be compiled as a library, that's for sure, but I
don't know how you go about it. My first guess would be something
like:

vbc /t:library Global.asax.vb myFirstPage.vb mySecondPage.vb
out:myNamespace.dll

If I were you, I'd try this : create one Global.asax containing the
line mentioned above. Create one Global.asax.vb containing :

Imports System.Web
Imports System.Web.SessionState

Public Class Global
Inherits System.Web.HttpApplication

Public Sub New()
MyBase.New()
InitializeComponent()
End Sub

Private components As System.ComponentModel.IContainer

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container()
End Sub

Public Test() as String
Return "hello";
End Sub
End Class

Create one "TestPage.aspx" containing :

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="TestPage.aspx.vb" Inherits="myNamespace.TestPage"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>test</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server"></asp:Label>
</form>
</body>
</HTML>

And finally, one TestPage.vb containing:

Public Class TestPage
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Label1.Text = Global.Test
End Sub
End Class

(watch the line feeds)

Then, compile it (unfortunately, I can't help you there) and try
http://localhost/myNamespace/TestPage.aspx.

You might need a Web.config file. If it's the case and you can't wait
for your VS to arrive, just say so and I'll give you a generic one.
But with all this, you should have a proper web app (provided you have
declared your app as a folder in IIS) and a working test page calling
a global routine in the Global class (phew!).

If you manage all this without VS, then I'm in awe.

Another thought : maybe it could help you if I sent you a "blank"
project, containing everything, the project files, the test page and
the global files? If so, just give me your mail adress (don't forget
to put nospam bs in it) and I'll send it to you.


I just got the VS today and will probably not get to it until next week, but
I will try your examples. I need to get a handle on the whole code behind
business.

I just use Dreamweaver and built a couple sites with about 40 or so pages
(that would double of course with code behind).

I'll let you know how I come out.

Thanks,

Tom
Best of luck !

Michel

Nov 19 '05 #4

P: n/a
"tshad" <ts**********@ftsolutions.com> wrote:
I just got the VS today and will probably not get to it until next week, but
I will try your examples. I need to get a handle on the whole code behind
business.
Lucky you ! :)
I just use Dreamweaver and built a couple sites with about 40 or so pages
(that would double of course with code behind).


Actually, it wouldn't, because, all things being equal, the
code-behind belongs to the page itself, so it would still be 40 pages,
each one being comprised of code-afore html and code-behind VB (so to
speak).

I'm sure you'll keep us all posted, because your questions will begin
to flow from next week on :D Have fun!

Michel
Nov 19 '05 #5

P: n/a

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
"tshad" <ts**********@ftsolutions.com> wrote:
I just got the VS today and will probably not get to it until next week,
but
I will try your examples. I need to get a handle on the whole code
behind
business.


Lucky you ! :)

I finally loaded my trial version of VS and need a little help getting
started with setting up the Global.asax.vb file to do my shared functions.

I am not starting a problem (I already have that set up without Code-behind
at the moment).

I just want to create the Global.asax.vb file. I am not sure what I write
and what VS does for me.

Do I just start with a new Text file?

How do I tell it that this is the Global.asax file (other than saving it
that way)?

Where do I tell it to compile it?

I assume this will create my .dll that I move to my bin folder.

Thanks,

Tom
Nov 19 '05 #6

P: n/a
Hi Tom!

Here is a somewhat standard procedure to achieve what you're looking
for.

As you will see, the "Visual" in "Visual Studio" will save you a lot
of time/hassles.

I will assume that you have never used any version of VS.

1) Launch VS. Create a Solution (File / New / New Solution). In the
Dialog that appears, just type a name, don't choose "Visual Basic
Projects" just yet. Let's call it TomSolution. Click OK.

2) Show the Solution Explorer window by choosing that option in the
View menu (I guess it's called View, my version isn't an english one,
third menu anyway).

3) Right-click on the Solution name in the Solution Explorer window,
and click "Add / Add new project".

4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on
the right. Give it a name - TomApp - and click OK. In fact, you're not
giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".

5) After a few seconds, a default project is created. The Solution
Explorer shows a list of new items :
TomApp (the project)
References (a folder)
AssemblyInfo.vb
Global.asax
Styles.css
Web.config
WebForm1.aspx

6) Double-click on Global.asax. You get to the Design view of
Global.asax. This is a place where you're supposed to add components,
I guess, but I've never used it this way. Type F7 or choose "Code" in
the "View" menu.

7) That's it!!! This is where you wanted to be since the beginning. At
this point, have a glass of champagne, it's on me!!

8) Add a new function below the existing subs:

Shared Function TextFeed()
Return "Hello global shared world"
End Function

9) Double-click on Webform1.aspx in the Solution Explorer. This takes
you to the design view of that page.

10) There is a toolbox tab somewhere (you'll get used to it very
quickly, but it can be a little unsettling at the beginning : tabs
everywhere, pinned to the left, docked to the right...). Click on it,
make sure the "Web Forms" subtab is selected, click on "Label" and
drag that to the page, anywhere. Just leave it's properties at their
default.

11) Type F7 or click on "Code" in the View menu.

12) A default stub is already in here. You have a Page_Load sub, which
is executed when the... page loads, yes. Inside this sub, just type :
Label1.Text = Global.TextFeed

13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and
shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.

The Shared Function you created in the Global class is indeed global
to the application, that is, all pages and classes that it contains.
It is also static, which means that it is shared by all instances of
that application (which instantiates itself everytime a user logs onto
your site).

Be aware that, whereas Global.asax has two different views (Design and
Code), aspx pages have three (Graphical Design mode, HTML Design mode,
and Code).

If anything is still unclear, please ask.

Have fun!

Michel


"tshad" <ts**********@ftsolutions.com> wrote in message news:<OQ**************@TK2MSFTNGP14.phx.gbl>...
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
"tshad" <ts**********@ftsolutions.com> wrote:
I just got the VS today and will probably not get to it until next week,
but
I will try your examples. I need to get a handle on the whole code
behind
business.


Lucky you ! :)

I finally loaded my trial version of VS and need a little help getting
started with setting up the Global.asax.vb file to do my shared functions.

I am not starting a problem (I already have that set up without Code-behind
at the moment).

I just want to create the Global.asax.vb file. I am not sure what I write
and what VS does for me.

Do I just start with a new Text file?

How do I tell it that this is the Global.asax file (other than saving it
that way)?

Where do I tell it to compile it?

I assume this will create my .dll that I move to my bin folder.

Thanks,

Tom

Nov 19 '05 #7

P: n/a
Hi Michel,

As you can see I am getting started with the VS and Classes. I will play
with your list this weekend to get it down. I actually have played with VS
for Visual Basic 6, so I have an idea how it works. I just haven't got down
to playing with it to get the ins and outs.

Thanks,

Tom

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom!

Here is a somewhat standard procedure to achieve what you're looking
for.

As you will see, the "Visual" in "Visual Studio" will save you a lot
of time/hassles.

I will assume that you have never used any version of VS.

1) Launch VS. Create a Solution (File / New / New Solution). In the
Dialog that appears, just type a name, don't choose "Visual Basic
Projects" just yet. Let's call it TomSolution. Click OK.

2) Show the Solution Explorer window by choosing that option in the
View menu (I guess it's called View, my version isn't an english one,
third menu anyway).

3) Right-click on the Solution name in the Solution Explorer window,
and click "Add / Add new project".

4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on
the right. Give it a name - TomApp - and click OK. In fact, you're not
giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".

5) After a few seconds, a default project is created. The Solution
Explorer shows a list of new items :
TomApp (the project)
References (a folder)
AssemblyInfo.vb
Global.asax
Styles.css
Web.config
WebForm1.aspx

6) Double-click on Global.asax. You get to the Design view of
Global.asax. This is a place where you're supposed to add components,
I guess, but I've never used it this way. Type F7 or choose "Code" in
the "View" menu.

7) That's it!!! This is where you wanted to be since the beginning. At
this point, have a glass of champagne, it's on me!!

8) Add a new function below the existing subs:

Shared Function TextFeed()
Return "Hello global shared world"
End Function

9) Double-click on Webform1.aspx in the Solution Explorer. This takes
you to the design view of that page.

10) There is a toolbox tab somewhere (you'll get used to it very
quickly, but it can be a little unsettling at the beginning : tabs
everywhere, pinned to the left, docked to the right...). Click on it,
make sure the "Web Forms" subtab is selected, click on "Label" and
drag that to the page, anywhere. Just leave it's properties at their
default.

11) Type F7 or click on "Code" in the View menu.

12) A default stub is already in here. You have a Page_Load sub, which
is executed when the... page loads, yes. Inside this sub, just type :
Label1.Text = Global.TextFeed

13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and
shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.

The Shared Function you created in the Global class is indeed global
to the application, that is, all pages and classes that it contains.
It is also static, which means that it is shared by all instances of
that application (which instantiates itself everytime a user logs onto
your site).

Be aware that, whereas Global.asax has two different views (Design and
Code), aspx pages have three (Graphical Design mode, HTML Design mode,
and Code).

If anything is still unclear, please ask.

Have fun!

Michel


"tshad" <ts**********@ftsolutions.com> wrote in message
news:<OQ**************@TK2MSFTNGP14.phx.gbl>...
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
> "tshad" <ts**********@ftsolutions.com> wrote:
>> I just got the VS today and will probably not get to it until next
>> week,
>> but
>> I will try your examples. I need to get a handle on the whole code
>> behind
>> business.
>
> Lucky you ! :)
>

I finally loaded my trial version of VS and need a little help getting
started with setting up the Global.asax.vb file to do my shared
functions.

I am not starting a problem (I already have that set up without
Code-behind
at the moment).

I just want to create the Global.asax.vb file. I am not sure what I
write
and what VS does for me.

Do I just start with a new Text file?

How do I tell it that this is the Global.asax file (other than saving it
that way)?

Where do I tell it to compile it?

I assume this will create my .dll that I move to my bin folder.

Thanks,

Tom

Nov 19 '05 #8

P: n/a
Hi Michel,

I just started doing your list. And had a question.

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom!

Here is a somewhat standard procedure to achieve what you're looking
for.

As you will see, the "Visual" in "Visual Studio" will save you a lot
of time/hassles.

I will assume that you have never used any version of VS.

1) Launch VS. Create a Solution (File / New / New Solution). In the
Dialog that appears, just type a name, don't choose "Visual Basic
Projects" just yet. Let's call it TomSolution. Click OK.

2) Show the Solution Explorer window by choosing that option in the
View menu (I guess it's called View, my version isn't an english one,
third menu anyway).

3) Right-click on the Solution name in the Solution Explorer window,
and click "Add / Add new project".

4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on
the right. Give it a name - TomApp - and click OK. In fact, you're not
giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".
It won't let me put in a name, but will allow me to change the location, as
you mention and then the name changes. I assume this is how it is done.

5) After a few seconds, a default project is created. The Solution
Explorer shows a list of new items :
TomApp (the project)
References (a folder)
AssemblyInfo.vb
Global.asax
Styles.css
Web.config
WebForm1.aspx

6) Double-click on Global.asax. You get to the Design view of
Global.asax. This is a place where you're supposed to add components,
I guess, but I've never used it this way. Type F7 or choose "Code" in
the "View" menu.

7) That's it!!! This is where you wanted to be since the beginning. At
this point, have a glass of champagne, it's on me!!
Had my glass. Where do I send the bill :)

8) Add a new function below the existing subs:

Shared Function TextFeed()
Return "Hello global shared world"
End Function

9) Double-click on Webform1.aspx in the Solution Explorer. This takes
you to the design view of that page.

10) There is a toolbox tab somewhere (you'll get used to it very
quickly, but it can be a little unsettling at the beginning : tabs
everywhere, pinned to the left, docked to the right...). Click on it,
make sure the "Web Forms" subtab is selected, click on "Label" and
drag that to the page, anywhere. Just leave it's properties at their
default.

11) Type F7 or click on "Code" in the View menu.

12) A default stub is already in here. You have a Page_Load sub, which
is executed when the... page loads, yes. Inside this sub, just type :
Label1.Text = Global.TextFeed

13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and
shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.

I tried that, but got an error:

"Error while trying to run object: Unable to start debugging on the web
server. Debugging failed because integrated Windows authentication is not
enabled. Click help for more information."

My other pages run, why not VS?

Thanks,

Tom The Shared Function you created in the Global class is indeed global
to the application, that is, all pages and classes that it contains.
It is also static, which means that it is shared by all instances of
that application (which instantiates itself everytime a user logs onto
your site).

Be aware that, whereas Global.asax has two different views (Design and
Code), aspx pages have three (Graphical Design mode, HTML Design mode,
and Code).

If anything is still unclear, please ask.

Have fun!

Michel


"tshad" <ts**********@ftsolutions.com> wrote in message
news:<OQ**************@TK2MSFTNGP14.phx.gbl>...
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
> "tshad" <ts**********@ftsolutions.com> wrote:
>> I just got the VS today and will probably not get to it until next
>> week,
>> but
>> I will try your examples. I need to get a handle on the whole code
>> behind
>> business.
>
> Lucky you ! :)
>

I finally loaded my trial version of VS and need a little help getting
started with setting up the Global.asax.vb file to do my shared
functions.

I am not starting a problem (I already have that set up without
Code-behind
at the moment).

I just want to create the Global.asax.vb file. I am not sure what I
write
and what VS does for me.

Do I just start with a new Text file?

How do I tell it that this is the Global.asax file (other than saving it
that way)?

Where do I tell it to compile it?

I assume this will create my .dll that I move to my bin folder.

Thanks,

Tom

Nov 19 '05 #9

P: n/a
Also, I can't find a "code" view in the View menu and can't find anything
that has an F7 shortcut on it.

I tried opening up one of my current pages and it show the code, but I can't
find a way to see how it looks in a design mode. There must be one (I would
assume), similar to the one you had me put the label on.

This is an aspx page. I wanted to see how the asp.net objects are rendered
inside VS.

Thanks,

Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Michel,

I just started doing your list. And had a question.

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom!

Here is a somewhat standard procedure to achieve what you're looking
for.

As you will see, the "Visual" in "Visual Studio" will save you a lot
of time/hassles.

I will assume that you have never used any version of VS.

1) Launch VS. Create a Solution (File / New / New Solution). In the
Dialog that appears, just type a name, don't choose "Visual Basic
Projects" just yet. Let's call it TomSolution. Click OK.

2) Show the Solution Explorer window by choosing that option in the
View menu (I guess it's called View, my version isn't an english one,
third menu anyway).

3) Right-click on the Solution name in the Solution Explorer window,
and click "Add / Add new project".

4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on
the right. Give it a name - TomApp - and click OK. In fact, you're not
giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".


It won't let me put in a name, but will allow me to change the location,
as you mention and then the name changes. I assume this is how it is
done.

5) After a few seconds, a default project is created. The Solution
Explorer shows a list of new items :
TomApp (the project)
References (a folder)
AssemblyInfo.vb
Global.asax
Styles.css
Web.config
WebForm1.aspx

6) Double-click on Global.asax. You get to the Design view of
Global.asax. This is a place where you're supposed to add components,
I guess, but I've never used it this way. Type F7 or choose "Code" in
the "View" menu.

7) That's it!!! This is where you wanted to be since the beginning. At
this point, have a glass of champagne, it's on me!!


Had my glass. Where do I send the bill :)

8) Add a new function below the existing subs:

Shared Function TextFeed()
Return "Hello global shared world"
End Function

9) Double-click on Webform1.aspx in the Solution Explorer. This takes
you to the design view of that page.

10) There is a toolbox tab somewhere (you'll get used to it very
quickly, but it can be a little unsettling at the beginning : tabs
everywhere, pinned to the left, docked to the right...). Click on it,
make sure the "Web Forms" subtab is selected, click on "Label" and
drag that to the page, anywhere. Just leave it's properties at their
default.

11) Type F7 or click on "Code" in the View menu.

12) A default stub is already in here. You have a Page_Load sub, which
is executed when the... page loads, yes. Inside this sub, just type :
Label1.Text = Global.TextFeed

13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and
shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.


I tried that, but got an error:

"Error while trying to run object: Unable to start debugging on the web
server. Debugging failed because integrated Windows authentication is not
enabled. Click help for more information."

My other pages run, why not VS?

Thanks,

Tom
The Shared Function you created in the Global class is indeed global
to the application, that is, all pages and classes that it contains.
It is also static, which means that it is shared by all instances of
that application (which instantiates itself everytime a user logs onto
your site).

Be aware that, whereas Global.asax has two different views (Design and
Code), aspx pages have three (Graphical Design mode, HTML Design mode,
and Code).

If anything is still unclear, please ask.

Have fun!

Michel


"tshad" <ts**********@ftsolutions.com> wrote in message
news:<OQ**************@TK2MSFTNGP14.phx.gbl>...
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
> "tshad" <ts**********@ftsolutions.com> wrote:
>> I just got the VS today and will probably not get to it until next
>> week,
>> but
>> I will try your examples. I need to get a handle on the whole code
>> behind
>> business.
>
> Lucky you ! :)
>
I finally loaded my trial version of VS and need a little help getting
started with setting up the Global.asax.vb file to do my shared
functions.

I am not starting a problem (I already have that set up without
Code-behind
at the moment).

I just want to create the Global.asax.vb file. I am not sure what I
write
and what VS does for me.

Do I just start with a new Text file?

How do I tell it that this is the Global.asax file (other than saving it
that way)?

Where do I tell it to compile it?

I assume this will create my .dll that I move to my bin folder.

Thanks,

Tom


Nov 19 '05 #10

P: n/a
"tshad" <ts**********@ftsolutions.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl...
Also, I can't find a "code" view in the View menu and can't find anything
that has an F7 shortcut on it.

I tried opening up one of my current pages and it show the code, but I
can't find a way to see how it looks in a design mode. There must be one
(I would assume), similar to the one you had me put the label on.

This is an aspx page. I wanted to see how the asp.net objects are
rendered inside VS.
I just looked at the page you had me open and it does show code,designer,
(html source or design) plus a couple of others. It then it goes to
Solution Explorer. It appears that if you open a page created outside of
VS, it won't give you a design view. The view menu starts at Solution
Explorer.

Also, what is Web Browser at the bottom of the View menu for. I assumed it
would open your page in a browser, but it just opens the
http://msdn.microsoft.com/ site.

Thanks,

Tom
Thanks,

Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Michel,

I just started doing your list. And had a question.

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom!

Here is a somewhat standard procedure to achieve what you're looking
for.

As you will see, the "Visual" in "Visual Studio" will save you a lot
of time/hassles.

I will assume that you have never used any version of VS.

1) Launch VS. Create a Solution (File / New / New Solution). In the
Dialog that appears, just type a name, don't choose "Visual Basic
Projects" just yet. Let's call it TomSolution. Click OK.

2) Show the Solution Explorer window by choosing that option in the
View menu (I guess it's called View, my version isn't an english one,
third menu anyway).

3) Right-click on the Solution name in the Solution Explorer window,
and click "Add / Add new project".

4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on
the right. Give it a name - TomApp - and click OK. In fact, you're not
giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".


It won't let me put in a name, but will allow me to change the location,
as you mention and then the name changes. I assume this is how it is
done.

5) After a few seconds, a default project is created. The Solution
Explorer shows a list of new items :
TomApp (the project)
References (a folder)
AssemblyInfo.vb
Global.asax
Styles.css
Web.config
WebForm1.aspx

6) Double-click on Global.asax. You get to the Design view of
Global.asax. This is a place where you're supposed to add components,
I guess, but I've never used it this way. Type F7 or choose "Code" in
the "View" menu.

7) That's it!!! This is where you wanted to be since the beginning. At
this point, have a glass of champagne, it's on me!!


Had my glass. Where do I send the bill :)

8) Add a new function below the existing subs:

Shared Function TextFeed()
Return "Hello global shared world"
End Function

9) Double-click on Webform1.aspx in the Solution Explorer. This takes
you to the design view of that page.

10) There is a toolbox tab somewhere (you'll get used to it very
quickly, but it can be a little unsettling at the beginning : tabs
everywhere, pinned to the left, docked to the right...). Click on it,
make sure the "Web Forms" subtab is selected, click on "Label" and
drag that to the page, anywhere. Just leave it's properties at their
default.

11) Type F7 or click on "Code" in the View menu.

12) A default stub is already in here. You have a Page_Load sub, which
is executed when the... page loads, yes. Inside this sub, just type :
Label1.Text = Global.TextFeed

13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and
shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.


I tried that, but got an error:

"Error while trying to run object: Unable to start debugging on the web
server. Debugging failed because integrated Windows authentication is
not enabled. Click help for more information."

My other pages run, why not VS?

Thanks,

Tom
The Shared Function you created in the Global class is indeed global
to the application, that is, all pages and classes that it contains.
It is also static, which means that it is shared by all instances of
that application (which instantiates itself everytime a user logs onto
your site).

Be aware that, whereas Global.asax has two different views (Design and
Code), aspx pages have three (Graphical Design mode, HTML Design mode,
and Code).

If anything is still unclear, please ask.

Have fun!

Michel


"tshad" <ts**********@ftsolutions.com> wrote in message
news:<OQ**************@TK2MSFTNGP14.phx.gbl>...
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
> "tshad" <ts**********@ftsolutions.com> wrote:
>> I just got the VS today and will probably not get to it until next
>> week,
>> but
>> I will try your examples. I need to get a handle on the whole code
>> behind
>> business.
>
> Lucky you ! :)
>
I finally loaded my trial version of VS and need a little help getting
started with setting up the Global.asax.vb file to do my shared
functions.

I am not starting a problem (I already have that set up without
Code-behind
at the moment).

I just want to create the Global.asax.vb file. I am not sure what I
write
and what VS does for me.

Do I just start with a new Text file?

How do I tell it that this is the Global.asax file (other than saving
it
that way)?

Where do I tell it to compile it?

I assume this will create my .dll that I move to my bin folder.

Thanks,

Tom



Nov 19 '05 #11

P: n/a
Hi Tom,

Let me try to answer your last 3 messages (sorry for being late, I
only browse the groups when I get the chance).
4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on the right. Give it a name - TomApp - and click OK. In fact, you're not giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".
It won't let me put in a name, but will allow me to change the location, as
you mention and then the name changes. I assume this is how it is done.
It is. The idea behind it being that when you specify a location and a
name for the folder, it becomes a physical directory in your
c:\Inetpub\wwwroot\ folder, and also a web application of that same
name, pointing to that directory.
Where do I send the bill :)
bg****@microsoft.com ! :p
13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.

I tried that, but got an error:

"Error while trying to run object: Unable to start debugging on the web
server. Debugging failed because integrated Windows authentication is not
enabled. Click help for more information."

My other pages run, why not VS?
Oh, this is one of the things that's quite difficult to set up at the
beginning, but once you get it right, you forget all about it. Guess
what? I forgot all about it. IIRC, it's about giving the debugger
enough permissions to attach itself to the IIS process. Try this :

- Somewhere on your computer is something called "IIS Internet
Services". Your best bet would be Control Panels/Administrative
tools/IIS Internet Services (it might have a slightly different name,
my XP is not an english one). And I'm not quite sure where it is
because I moved it. Try and locate it, and launch it.

- It shows a tree, like this :
IIS Internet Services
+ Name of your computer
+ Web sites
+ Default Web Site
+ IIS Help
+ _vti_bin
+ printers
...
+ TomApp (if you called it that, obviously)

- Right-click on TomApp. Choose the Folder Security tab. In "Anonymous
connections...", click on "Change". In the dialog box that shows up,
all the way down is a checkbox "Windows integrated authentification".
Check it, OK, OK, you should be good to go.
Also, I can't find a "code" view in the View menu and can't find anything
that has an F7 shortcut on it.

I tried opening up one of my current pages and it show the code, but I can't
find a way to see how it looks in a design mode. There must be one (I would
assume), similar to the one you had me put the label on.

This is an aspx page. I wanted to see how the asp.net objects are rendered
inside VS.
I think I know what the problem is. You probably imported or copied
your own pages into the solution/project/web folder. But when you
create an aspx page from *inside* VS, it does a lot of stuff : it sets
up and creates the corresponding code-behind file, plus a .resx files
that contains definitions for numerous things, like handles for object
and stuff. To be honest, the .resx file is not something I'd like to
dwell into. I've had a glimpse of it, once or twice, and very quickly
decided I'd never come back, and never did.

So, the problem is that, as you didn't create the page from inside VS,
the code-behind page hasn't been created and so you don't get the Code
menu. If I were you, I'd create a page in VS, then delete it's content
and *paste* the content of your own page, rather than copying the page
into the folder. Then you'll have all options available.
I just looked at the page you had me open and it does show code,designer,
(html source or design) plus a couple of others. It then it goes to
Solution Explorer. It appears that if you open a page created outside of
VS, it won't give you a design view. The view menu starts at Solution
Explorer.
Exactly. I hadn't tested this, but you're confirming what I suspected.
It's all about what VS does for you. The other thread you created
(where everyone is speaking for or against code-behind, which makes a
very interesting read, btw) highlights the fact that code-behind is -
I think - the way to go when you use VS, and not at all the way to go
when you don't because VS does an awful lot of stuff to ease your work
: it creates code to initialize the controls when you just drag'n'drop
them on the html editor in design view (you can see this when you go
to Code View and unfold the "Web Form Designer generated code"
section, even more impressive when you start using the DataAdapter
objects, the amount and quality of generated code is absolutely
amazing), handles the session-persistent objects, handles the events,
postback mechanisms, and so on. It really cuts down the amount of
coding you have to do. So, again, go the VS way all the way, trying to
compromise between VS-automated and "manual" modes will only bring
frustration. Even when I said "paste in the code of your own page", I
should have said : "restart your page from scratch in VS". It appears
to be a waste of time, but in the end, I'm quite confident it'll save
you a lot of time. Plus it will give you a chance to "practice". As
you've got a background with VS6, you'll get up to speed in no time.
Also, what is Web Browser at the bottom of the View menu for. I assumed
it would open your page in a browser, but it just opens the
http://msdn.microsoft.com/ site.


It's only an embedded browser. If you call it this way (from the View
menu), it takes you to the msdn site because that's the default
startup page (must be an option somewhere in the prefs), but you can
also call it by right-clicking on a page in html design view and
clicking on "Show in browser". You also have an url bar that appears,
which you can use to surf anywhere. I guess it's all about having a
self-contained IDE, but you can just use Explorer or any other
browser, to the same effect. I believe that when you test your project
with F5, the default behavior is to launch an external Explorer
windows. On a fast machine, either solution is the same, speed-wise. I
just never use the internal browser. But that's just me.

I understand your project is already 30-ish pages. I realize it could
be a hassle to start over from scratch, but I'm not sure there's an
alternative. IMHO, trying to paste bits of it will only take more
time, lead to confusion, the controls won't be properly initialized...
Anyway, it's your choice. Try both ways.

HTH,

Michel
Nov 19 '05 #12

P: n/a
> bg****@microsoft.com ! :p

Haven't ever seen that email address, but it could work. The one that is
known is bi***@microsoft.com.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom,

Let me try to answer your last 3 messages (sorry for being late, I
only browse the groups when I get the chance).
4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on the right. Give it a name - TomApp - and click OK. In fact, you're not giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".
It won't let me put in a name, but will allow me to change the location,
as
you mention and then the name changes. I assume this is how it is done.


It is. The idea behind it being that when you specify a location and a
name for the folder, it becomes a physical directory in your
c:\Inetpub\wwwroot\ folder, and also a web application of that same
name, pointing to that directory.
Where do I send the bill :)


bg****@microsoft.com ! :p
13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.

I tried that, but got an error:

"Error while trying to run object: Unable to start debugging on the web
server. Debugging failed because integrated Windows authentication is
not
enabled. Click help for more information."

My other pages run, why not VS?


Oh, this is one of the things that's quite difficult to set up at the
beginning, but once you get it right, you forget all about it. Guess
what? I forgot all about it. IIRC, it's about giving the debugger
enough permissions to attach itself to the IIS process. Try this :

- Somewhere on your computer is something called "IIS Internet
Services". Your best bet would be Control Panels/Administrative
tools/IIS Internet Services (it might have a slightly different name,
my XP is not an english one). And I'm not quite sure where it is
because I moved it. Try and locate it, and launch it.

- It shows a tree, like this :
IIS Internet Services
+ Name of your computer
+ Web sites
+ Default Web Site
+ IIS Help
+ _vti_bin
+ printers
...
+ TomApp (if you called it that, obviously)

- Right-click on TomApp. Choose the Folder Security tab. In "Anonymous
connections...", click on "Change". In the dialog box that shows up,
all the way down is a checkbox "Windows integrated authentification".
Check it, OK, OK, you should be good to go.
Also, I can't find a "code" view in the View menu and can't find anything
that has an F7 shortcut on it.

I tried opening up one of my current pages and it show the code, but I
can't
find a way to see how it looks in a design mode. There must be one (I
would
assume), similar to the one you had me put the label on.

This is an aspx page. I wanted to see how the asp.net objects are
rendered
inside VS.


I think I know what the problem is. You probably imported or copied
your own pages into the solution/project/web folder. But when you
create an aspx page from *inside* VS, it does a lot of stuff : it sets
up and creates the corresponding code-behind file, plus a .resx files
that contains definitions for numerous things, like handles for object
and stuff. To be honest, the .resx file is not something I'd like to
dwell into. I've had a glimpse of it, once or twice, and very quickly
decided I'd never come back, and never did.

So, the problem is that, as you didn't create the page from inside VS,
the code-behind page hasn't been created and so you don't get the Code
menu. If I were you, I'd create a page in VS, then delete it's content
and *paste* the content of your own page, rather than copying the page
into the folder. Then you'll have all options available.
I just looked at the page you had me open and it does show code,designer,
(html source or design) plus a couple of others. It then it goes to
Solution Explorer. It appears that if you open a page created outside of
VS, it won't give you a design view. The view menu starts at Solution
Explorer.


Exactly. I hadn't tested this, but you're confirming what I suspected.
It's all about what VS does for you. The other thread you created
(where everyone is speaking for or against code-behind, which makes a
very interesting read, btw) highlights the fact that code-behind is -
I think - the way to go when you use VS, and not at all the way to go
when you don't because VS does an awful lot of stuff to ease your work
: it creates code to initialize the controls when you just drag'n'drop
them on the html editor in design view (you can see this when you go
to Code View and unfold the "Web Form Designer generated code"
section, even more impressive when you start using the DataAdapter
objects, the amount and quality of generated code is absolutely
amazing), handles the session-persistent objects, handles the events,
postback mechanisms, and so on. It really cuts down the amount of
coding you have to do. So, again, go the VS way all the way, trying to
compromise between VS-automated and "manual" modes will only bring
frustration. Even when I said "paste in the code of your own page", I
should have said : "restart your page from scratch in VS". It appears
to be a waste of time, but in the end, I'm quite confident it'll save
you a lot of time. Plus it will give you a chance to "practice". As
you've got a background with VS6, you'll get up to speed in no time.
Also, what is Web Browser at the bottom of the View menu for. I assumed
it would open your page in a browser, but it just opens the
http://msdn.microsoft.com/ site.


It's only an embedded browser. If you call it this way (from the View
menu), it takes you to the msdn site because that's the default
startup page (must be an option somewhere in the prefs), but you can
also call it by right-clicking on a page in html design view and
clicking on "Show in browser". You also have an url bar that appears,
which you can use to surf anywhere. I guess it's all about having a
self-contained IDE, but you can just use Explorer or any other
browser, to the same effect. I believe that when you test your project
with F5, the default behavior is to launch an external Explorer
windows. On a fast machine, either solution is the same, speed-wise. I
just never use the internal browser. But that's just me.

I understand your project is already 30-ish pages. I realize it could
be a hassle to start over from scratch, but I'm not sure there's an
alternative. IMHO, trying to paste bits of it will only take more
time, lead to confusion, the controls won't be properly initialized...
Anyway, it's your choice. Try both ways.

HTH,

Michel

Nov 19 '05 #13

P: n/a
Michel,

Thanks for the info.

I think I will probably use VS to build classes (such as myUtils that are
not page specific) and Globals.asax, but as you say trying to use my other
pages in VS would be quite difficult. I am sure I would have the same
problem if I went from VS to DW.

I will probably look at using code-behind to allow someone to do some of the
design, but I will probably not compile it. I'll know better once I have
worked with it more.

Thanks for all the help,

Tom.

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Hi Tom,

Let me try to answer your last 3 messages (sorry for being late, I
only browse the groups when I get the chance).
4) In the dialog that appears, you can now choose "Visual Basic
Projects". Then choose "ASP.Net Web Application" in the icon list on the right. Give it a name - TomApp - and click OK. In fact, you're not giving a name, but the full path of the web app, in this case,
"http://localhost/TomApp".
It won't let me put in a name, but will allow me to change the location,
as
you mention and then the name changes. I assume this is how it is done.


It is. The idea behind it being that when you specify a location and a
name for the folder, it becomes a physical directory in your
c:\Inetpub\wwwroot\ folder, and also a web application of that same
name, pointing to that directory.
Where do I send the bill :)


bg****@microsoft.com ! :p
13) Type F5 or choose "Run" in the Debug menu (could be "Start"
instead of "Run", not quite sure). This opens your default browser and shows the Webform1.aspx page that you created. If everything went
well, it should show "Hello global shared world" somewhere in the
middle of it.

I tried that, but got an error:

"Error while trying to run object: Unable to start debugging on the web
server. Debugging failed because integrated Windows authentication is
not
enabled. Click help for more information."

My other pages run, why not VS?


Oh, this is one of the things that's quite difficult to set up at the
beginning, but once you get it right, you forget all about it. Guess
what? I forgot all about it. IIRC, it's about giving the debugger
enough permissions to attach itself to the IIS process. Try this :

- Somewhere on your computer is something called "IIS Internet
Services". Your best bet would be Control Panels/Administrative
tools/IIS Internet Services (it might have a slightly different name,
my XP is not an english one). And I'm not quite sure where it is
because I moved it. Try and locate it, and launch it.

- It shows a tree, like this :
IIS Internet Services
+ Name of your computer
+ Web sites
+ Default Web Site
+ IIS Help
+ _vti_bin
+ printers
...
+ TomApp (if you called it that, obviously)

- Right-click on TomApp. Choose the Folder Security tab. In "Anonymous
connections...", click on "Change". In the dialog box that shows up,
all the way down is a checkbox "Windows integrated authentification".
Check it, OK, OK, you should be good to go.
Also, I can't find a "code" view in the View menu and can't find anything
that has an F7 shortcut on it.

I tried opening up one of my current pages and it show the code, but I
can't
find a way to see how it looks in a design mode. There must be one (I
would
assume), similar to the one you had me put the label on.

This is an aspx page. I wanted to see how the asp.net objects are
rendered
inside VS.


I think I know what the problem is. You probably imported or copied
your own pages into the solution/project/web folder. But when you
create an aspx page from *inside* VS, it does a lot of stuff : it sets
up and creates the corresponding code-behind file, plus a .resx files
that contains definitions for numerous things, like handles for object
and stuff. To be honest, the .resx file is not something I'd like to
dwell into. I've had a glimpse of it, once or twice, and very quickly
decided I'd never come back, and never did.

So, the problem is that, as you didn't create the page from inside VS,
the code-behind page hasn't been created and so you don't get the Code
menu. If I were you, I'd create a page in VS, then delete it's content
and *paste* the content of your own page, rather than copying the page
into the folder. Then you'll have all options available.
I just looked at the page you had me open and it does show code,designer,
(html source or design) plus a couple of others. It then it goes to
Solution Explorer. It appears that if you open a page created outside of
VS, it won't give you a design view. The view menu starts at Solution
Explorer.


Exactly. I hadn't tested this, but you're confirming what I suspected.
It's all about what VS does for you. The other thread you created
(where everyone is speaking for or against code-behind, which makes a
very interesting read, btw) highlights the fact that code-behind is -
I think - the way to go when you use VS, and not at all the way to go
when you don't because VS does an awful lot of stuff to ease your work
: it creates code to initialize the controls when you just drag'n'drop
them on the html editor in design view (you can see this when you go
to Code View and unfold the "Web Form Designer generated code"
section, even more impressive when you start using the DataAdapter
objects, the amount and quality of generated code is absolutely
amazing), handles the session-persistent objects, handles the events,
postback mechanisms, and so on. It really cuts down the amount of
coding you have to do. So, again, go the VS way all the way, trying to
compromise between VS-automated and "manual" modes will only bring
frustration. Even when I said "paste in the code of your own page", I
should have said : "restart your page from scratch in VS". It appears
to be a waste of time, but in the end, I'm quite confident it'll save
you a lot of time. Plus it will give you a chance to "practice". As
you've got a background with VS6, you'll get up to speed in no time.
Also, what is Web Browser at the bottom of the View menu for. I assumed
it would open your page in a browser, but it just opens the
http://msdn.microsoft.com/ site.


It's only an embedded browser. If you call it this way (from the View
menu), it takes you to the msdn site because that's the default
startup page (must be an option somewhere in the prefs), but you can
also call it by right-clicking on a page in html design view and
clicking on "Show in browser". You also have an url bar that appears,
which you can use to surf anywhere. I guess it's all about having a
self-contained IDE, but you can just use Explorer or any other
browser, to the same effect. I believe that when you test your project
with F5, the default behavior is to launch an external Explorer
windows. On a fast machine, either solution is the same, speed-wise. I
just never use the internal browser. But that's just me.

I understand your project is already 30-ish pages. I realize it could
be a hassle to start over from scratch, but I'm not sure there's an
alternative. IMHO, trying to paste bits of it will only take more
time, lead to confusion, the controls won't be properly initialized...
Anyway, it's your choice. Try both ways.

HTH,

Michel

Nov 19 '05 #14

P: n/a
Kevin, are you implying that He doesn't know how to use email aliases?
Oh, ye of little faith... :)

Michel

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:<#F**************@tk2msftngp13.phx.gbl>...
bg****@microsoft.com ! :p


Haven't ever seen that email address, but it could work. The one that is
known is bi***@microsoft.com.

--
;-),

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

Nov 19 '05 #15

P: n/a
You're absolutely welcome, Tom.

Proceed as you feel. In the end, if you manage to grab a non-demo
version of VS, I'm quite sure you'll put DW where it belongs : the
fond memories shelf.

By the way, the site that helped me the most when I started asp.net is
http://www.asp.net/tutorials/quickstart.aspx. You might want to check
it.

Have fun !

Michel
"tshad" <ts**********@ftsolutions.com> wrote in message news:<uC**************@TK2MSFTNGP10.phx.gbl>...
Michel,

Thanks for the info.

I think I will probably use VS to build classes (such as myUtils that are
not page specific) and Globals.asax, but as you say trying to use my other
pages in VS would be quite difficult. I am sure I would have the same
problem if I went from VS to DW.

I will probably look at using code-behind to allow someone to do some of the
design, but I will probably not compile it. I'll know better once I have
worked with it more.

Thanks for all the help,

Tom.

Nov 19 '05 #16

P: n/a
Hey, I said it COULD work! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
Kevin, are you implying that He doesn't know how to use email aliases?
Oh, ye of little faith... :)

Michel

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:<#F**************@tk2msftngp13.phx.gbl>...
> bg****@microsoft.com ! :p


Haven't ever seen that email address, but it could work. The one that is
known is bi***@microsoft.com.

--
;-),

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

Nov 19 '05 #17

P: n/a
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
You're absolutely welcome, Tom.

Proceed as you feel. In the end, if you manage to grab a non-demo
version of VS, I'm quite sure you'll put DW where it belongs : the
fond memories shelf.
I don't thinks so. But I expect to use both. I don't use a lot of DW's
features because I don't want to be locked into it's proprietary way of
doing things (same as VS). Just from looking at both (granted I just
started with VS), I like DW much better for working with the Design side.
Also, even in DW I tend to work in the Code page and write (or copy and
paste) my objects instead of using DW's wizards to add the objects to the
page. I tend to be a more hands on type of person.

Even with using Word and DW, I use Textpad (editor) to do some of my stuff.

Each has it's own features I like.
By the way, the site that helped me the most when I started asp.net is
http://www.asp.net/tutorials/quickstart.aspx. You might want to check
it.
I will look at it.

Thanks,

Tom
Have fun !

Michel
"tshad" <ts**********@ftsolutions.com> wrote in message
news:<uC**************@TK2MSFTNGP10.phx.gbl>...
Michel,

Thanks for the info.

I think I will probably use VS to build classes (such as myUtils that are
not page specific) and Globals.asax, but as you say trying to use my
other
pages in VS would be quite difficult. I am sure I would have the same
problem if I went from VS to DW.

I will probably look at using code-behind to allow someone to do some of
the
design, but I will probably not compile it. I'll know better once I have
worked with it more.

Thanks for all the help,

Tom.

Nov 19 '05 #18

P: n/a
As an aside, I looked at the MS ASP.Net site you mentioned and all the
samples I looked at were code-beside.

Why?

Because it is easier to read.

Remember, one of the arguments for code-behind was that it was easier to
read. I just thought it was interesting that MS chose to use code-beside
for its tutorials :)

Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eR**************@TK2MSFTNGP12.phx.gbl...
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
You're absolutely welcome, Tom.

Proceed as you feel. In the end, if you manage to grab a non-demo
version of VS, I'm quite sure you'll put DW where it belongs : the
fond memories shelf.


I don't thinks so. But I expect to use both. I don't use a lot of DW's
features because I don't want to be locked into it's proprietary way of
doing things (same as VS). Just from looking at both (granted I just
started with VS), I like DW much better for working with the Design side.
Also, even in DW I tend to work in the Code page and write (or copy and
paste) my objects instead of using DW's wizards to add the objects to the
page. I tend to be a more hands on type of person.

Even with using Word and DW, I use Textpad (editor) to do some of my
stuff.

Each has it's own features I like.

By the way, the site that helped me the most when I started asp.net is
http://www.asp.net/tutorials/quickstart.aspx. You might want to check
it.


I will look at it.

Thanks,

Tom

Have fun !

Michel
"tshad" <ts**********@ftsolutions.com> wrote in message
news:<uC**************@TK2MSFTNGP10.phx.gbl>...
Michel,

Thanks for the info.

I think I will probably use VS to build classes (such as myUtils that
are
not page specific) and Globals.asax, but as you say trying to use my
other
pages in VS would be quite difficult. I am sure I would have the same
problem if I went from VS to DW.

I will probably look at using code-behind to allow someone to do some of
the
design, but I will probably not compile it. I'll know better once I
have
worked with it more.

Thanks for all the help,

Tom.


Nov 19 '05 #19

P: n/a
I believe they're code-beside because of the MS policy to provide "a
full development solution for free", meaning that you *can* write
programs for the .net platform for free using only Notepad if you
want. So, those examples cater for both types of users.

Again, my view on this is that if you own VS and are using it
properly, you can code several times faster and work on very very
complex projects (N-tier, security, auto-reconfigurable, the works),
where code is more important (in size) than design. It's not a matter
of coding practice or design, or programming quality, or even
programmer quality, it's just a matter of using a fantastic IDE that
grows on you. You can write macros and assign keystrokes to them,
which means you can type method or properties stubs in one keystroke.

The hassle of maintaining two different files for each page disappears
with VS, because going from one to the other is completely handled by
VS, as is the creation of all necessary bits of code, like
"codebehind=myPage.aspx.vb" or "inherits=myPage.vb". Note that I
originally started by writing Windows programs, not Internet ones.
Hence VS.

But I am fully aware, contrarily to some here, that my love is
threefold : I love .net because of the richness of the libraries, I
love c# for it's sheer beauty and I love VS as an IDE for the ease of
use.

At the very start of this thread - a month ago, can you believe it? -
you asked some questions about the structure of the pages for asp.net,
so I decided to share my passion for asp.net with you. In no way am I
going to force you into loving c# or the IDE, that's entirely up to
you, although at one point I had to explain what was the relation
between a page and it's codebehind because the example I had provided
was written with the IDE.

You seem to be rather intent on using DW and Textpad to code, and
there's nothing wrong with that on my end. I'll try my best to provide
you with examples you can use.

I'm not saying all this to you in particular, because I think you
understand all this already, but to those who would be tempted to
force you into practices you don't want. Maybe I should have posted
this in the other thread. Oh well.

All the best,

Michel
"tshad" <ts**********@ftsolutions.com> wrote in message news:<eB**************@TK2MSFTNGP12.phx.gbl>...
As an aside, I looked at the MS ASP.Net site you mentioned and all the
samples I looked at were code-beside.

Why?

Because it is easier to read.

Remember, one of the arguments for code-behind was that it was easier to
read. I just thought it was interesting that MS chose to use code-beside
for its tutorials :)

Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eR**************@TK2MSFTNGP12.phx.gbl...
"fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
You're absolutely welcome, Tom.

Proceed as you feel. In the end, if you manage to grab a non-demo
version of VS, I'm quite sure you'll put DW where it belongs : the
fond memories shelf.


I don't thinks so. But I expect to use both. I don't use a lot of DW's
features because I don't want to be locked into it's proprietary way of
doing things (same as VS). Just from looking at both (granted I just
started with VS), I like DW much better for working with the Design side.
Also, even in DW I tend to work in the Code page and write (or copy and
paste) my objects instead of using DW's wizards to add the objects to the
page. I tend to be a more hands on type of person.

Even with using Word and DW, I use Textpad (editor) to do some of my
stuff.

Each has it's own features I like.

By the way, the site that helped me the most when I started asp.net is
http://www.asp.net/tutorials/quickstart.aspx. You might want to check
it.


I will look at it.

Thanks,

Tom

Have fun !

Michel
"tshad" <ts**********@ftsolutions.com> wrote in message
news:<uC**************@TK2MSFTNGP10.phx.gbl>...
Michel,

Thanks for the info.

I think I will probably use VS to build classes (such as myUtils that
are
not page specific) and Globals.asax, but as you say trying to use my
other
pages in VS would be quite difficult. I am sure I would have the same
problem if I went from VS to DW.

I will probably look at using code-behind to allow someone to do some of
the
design, but I will probably not compile it. I'll know better once I
have
worked with it more.

Thanks for all the help,

Tom.


Nov 19 '05 #20

P: n/a
"fd123456" <fd******@hotmail.com> wrote in message
news:c8*************************@posting.google.co m...
I believe they're code-beside because of the MS policy to provide "a
full development solution for free", meaning that you *can* write
programs for the .net platform for free using only Notepad if you
want. So, those examples cater for both types of users.
Another good reason.
Again, my view on this is that if you own VS and are using it
properly, you can code several times faster and work on very very
complex projects (N-tier, security, auto-reconfigurable, the works),
where code is more important (in size) than design. It's not a matter
of coding practice or design, or programming quality, or even
programmer quality, it's just a matter of using a fantastic IDE that
grows on you. You can write macros and assign keystrokes to them,
which means you can type method or properties stubs in one keystroke.
I can see the benefit of VS from just the little bit I have played with it
and will probably like it more the more I use it. I hear from some that
have a problem with VS that the new version is much better, so I look
forward to seeing that.

The hassle of maintaining two different files for each page disappears
with VS, because going from one to the other is completely handled by
VS, as is the creation of all necessary bits of code, like
"codebehind=myPage.aspx.vb" or "inherits=myPage.vb". Note that I
originally started by writing Windows programs, not Internet ones.
Hence VS.

But I am fully aware, contrarily to some here, that my love is
threefold : I love .net because of the richness of the libraries, I
love c# for it's sheer beauty and I love VS as an IDE for the ease of
use.

At the very start of this thread - a month ago, can you believe it? -
My how time flies when you are having fun :)
you asked some questions about the structure of the pages for asp.net,
so I decided to share my passion for asp.net with you. In no way am I
going to force you into loving c# or the IDE, that's entirely up to
you, although at one point I had to explain what was the relation
between a page and it's codebehind because the example I had provided
was written with the IDE.
That was what I was looking for. If you don't have a passion for what you
are doing, that you are not enjoying what you do and that would be a
tragedy. Too many people hate their jobs these days.

Everyone has their preferences (which is why we don't have just MS). And
listening to people who have differing opinions is how to best form yours.
You seem to be rather intent on using DW and Textpad to code, and
there's nothing wrong with that on my end. I'll try my best to provide
you with examples you can use.
I do like DW - but am not wedded to it. It has a lot of pluses, but my
point with Textpad was that they are all tools and some are better than
others for different tasks and I like that fact that I have the option to
use different tools to accomplish the same thing. Back in the old days, you
didn't have that option. You used whatever the computer manufacture had to
offer - like it or not.

Tom
I'm not saying all this to you in particular, because I think you
understand all this already, but to those who would be tempted to
force you into practices you don't want. Maybe I should have posted
this in the other thread. Oh well.

All the best,

Michel
"tshad" <ts**********@ftsolutions.com> wrote in message
news:<eB**************@TK2MSFTNGP12.phx.gbl>...
As an aside, I looked at the MS ASP.Net site you mentioned and all the
samples I looked at were code-beside.

Why?

Because it is easier to read.

Remember, one of the arguments for code-behind was that it was easier to
read. I just thought it was interesting that MS chose to use code-beside
for its tutorials :)

Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eR**************@TK2MSFTNGP12.phx.gbl...
> "fd123456" <fd******@hotmail.com> wrote in message
> news:c8**************************@posting.google.c om...
>> You're absolutely welcome, Tom.
>>
>> Proceed as you feel. In the end, if you manage to grab a non-demo
>> version of VS, I'm quite sure you'll put DW where it belongs : the
>> fond memories shelf.
>
> I don't thinks so. But I expect to use both. I don't use a lot of
> DW's
> features because I don't want to be locked into it's proprietary way of
> doing things (same as VS). Just from looking at both (granted I just
> started with VS), I like DW much better for working with the Design
> side.
> Also, even in DW I tend to work in the Code page and write (or copy and
> paste) my objects instead of using DW's wizards to add the objects to
> the
> page. I tend to be a more hands on type of person.
>
> Even with using Word and DW, I use Textpad (editor) to do some of my
> stuff.
>
> Each has it's own features I like.
>>
>> By the way, the site that helped me the most when I started asp.net is
>> http://www.asp.net/tutorials/quickstart.aspx. You might want to check
>> it.
>
> I will look at it.
>
> Thanks,
>
> Tom
>>
>> Have fun !
>>
>> Michel
>>
>>
>> "tshad" <ts**********@ftsolutions.com> wrote in message
>> news:<uC**************@TK2MSFTNGP10.phx.gbl>...
>>> Michel,
>>>
>>> Thanks for the info.
>>>
>>> I think I will probably use VS to build classes (such as myUtils that
>>> are
>>> not page specific) and Globals.asax, but as you say trying to use my
>>> other
>>> pages in VS would be quite difficult. I am sure I would have the
>>> same
>>> problem if I went from VS to DW.
>>>
>>> I will probably look at using code-behind to allow someone to do some
>>> of
>>> the
>>> design, but I will probably not compile it. I'll know better once I
>>> have
>>> worked with it more.
>>>
>>> Thanks for all the help,
>>>
>>> Tom.
>
>

Nov 19 '05 #21

P: n/a
"tshad" <ts**********@ftsolutions.com> wrote in message news:<e0**************@TK2MSFTNGP10.phx.gbl>...
I can see the benefit of VS from just the little bit I have played with it
and will probably like it more the more I use it. I hear from some that
have a problem with VS that the new version is much better, so I look
forward to seeing that.
It's still a bit away, from what I've gathered. I expect VS 2005 to be
out sometime in the fourth quarter, and as I am on a tight production
schedule, I'm not taking risks with something that's not finished just
yet. I'll wait for 2.01. The specs look nice, though (lots of fancy
code generators, but it seems partial classes will yet again
complicate the matter of code-behind files. Half code-behinds,
anyone?).
My how time flies when you are having fun :)
Lol ! BTW, aren't you supposed to be coding right now? Go and make the
best site ever, you lazy bastard! ;)
I do like DW - but am not wedded to it. It has a lot of pluses, but my
point with Textpad was that they are all tools and some are better than
others for different tasks and I like that fact that I have the option to
use different tools to accomplish the same thing. Back in the old days, you
didn't have that option. You used whatever the computer manufacture had to
offer - like it or not.


True. But I chose to wed VS, she's just sooo sexy :)

Have fun,

Michel
Nov 19 '05 #22

P: n/a
Your arguments make sense. I hope the one half where you have a
deadline is coming well.
But I have enough problems dealing with the way asp.net does things
(and doesn't do things).
lol !!
And there is that honeymoon period that ends.
Well, as long as I've still got a hard-on... (ok, stop this thread
right now, it's going in directions we don't want to go!).

Michel
"tshad" <ts**********@ftsolutions.com> wrote in message news:<#F*************@TK2MSFTNGP15.phx.gbl>... "fd123456" <fd******@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:<e0**************@TK2MSFTNGP10.phx.gbl>...
I can see the benefit of VS from just the little bit I have played with
it
and will probably like it more the more I use it. I hear from some that
have a problem with VS that the new version is much better, so I look
forward to seeing that.


It's still a bit away, from what I've gathered. I expect VS 2005 to be
out sometime in the fourth quarter, and as I am on a tight production
schedule, I'm not taking risks with something that's not finished just
yet. I'll wait for 2.01. The specs look nice, though (lots of fancy
code generators, but it seems partial classes will yet again
complicate the matter of code-behind files. Half code-behinds,
anyone?).
My how time flies when you are having fun :)


Lol ! BTW, aren't you supposed to be coding right now? Go and make the
best site ever, you lazy bastard! ;)


I am trying, but had a little problem getting it to work. I am trying to
get our site up an running at the moment and have to split time between the
two. I can't spend a lot of time playing and learning when I have a
deadline to meet. But will keep on trucking.

I mentioned in the other thread that VS2005 looks much better to me and
don't want to spend a lot of time dealing with learning the 2003 way of
doing thing when in a short time (as the MS flies) I will have to learn
2005. If I were just starting that wouldn't be as much of a problem. But I
have enough problems dealing with the way asp.net does things (and doesn't
do things). I don't want to spend a lot of time getting VS to work with the
solutions I already have figured out.
I do like DW - but am not wedded to it. It has a lot of pluses, but my
point with Textpad was that they are all tools and some are better than
others for different tasks and I like that fact that I have the option to
use different tools to accomplish the same thing. Back in the old days,
you
didn't have that option. You used whatever the computer manufacture had
to
offer - like it or not.


True. But I chose to wed VS, she's just sooo sexy :)


But all that glitters is not gold :)

And there is that honeymoon period that ends.

Tom

Have fun,

Michel

Nov 19 '05 #23

This discussion thread is closed

Replies have been disabled for this discussion.