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

What is 'script' in a ASPNET file

P: n/a
Comming from JSP-HTML when I hear 'script' I think of JavaScript or perhaps
VBScript. But I think in ASP.NET they mean something else? I am bit confused
now.

Reading a book I see the following:

A simple Web page may look like the following.
<!-page directives-->
<%@ Page Language="VB" %>

<!--script-->
<script runat="server">
Private Sub SayHi(ByVal sender As Object, ByVal args As EventArgs)
Response.Write("Hello " + txtName.Value) End Sub
</script>

<!--layout-->
<html>
<head<title>Say Hi Page</title</head>

<body>
<form id="form1" runat="server"<input runat="server" id="txtName"
type="text" /<input runat="server" id="btnSayHi" type="button"
value="Say Hi" onserverclick="SayHi" />
</form>
</body>
</html>

Hence script refers to a piece of Visual Basic code here. Appearantly.

My question hence are:

1. Can you use javascript in ASP.NET pages?
2. Can you use VBScript in ASP.NET pages?
3 Does 'script' refer to the .NET C# or Visual Basic code, or to what I
should call real /scripting/ lanuguage code, like code in JavaScript of
VBScript?
4 Can anyone tell me if and what the difference would be with Java in a JSP
page and f.e. C# in an ASP.NET page

Marc Wentink

N.B. The question refers to the book I am reading Self Pace Training Kit for
the 70-528 Exam written by Glen Johnsson
Jun 27 '08 #1
Share this Question
Share on Google+
12 Replies


P: n/a
"Marc" <m,we******************@nki.nlwrote in message
news:ew**************@TK2MSFTNGP05.phx.gbl...
1. Can you use JavaScript in ASP.NET pages?
Yes.
2. Can you use VBScript in ASP.NET pages?
At a push. VBScript was the most popular server-side scripting language for
ASP Classic. However, ASP.NET uses the .NET Framework for server-side
interaction, usually with either C# or VB.NET. VBScript *can* be used for
client-side scripting, but that will work only in Microsoft IE. Therefore,
JavaScript is used almost exclusively for client-side scripting.
3 Does 'script' refer to the .NET C# or Visual Basic code, or to what I
should call real /scripting/ lanuguage code, like code in JavaScript of
VBScript?
ASP.NET allows server-side interaction either in-line or in code-behind -
which you use comes down to personal preference. When you use in-line
server-side coding, you use the
<script runat="server"/tag.
4 Can anyone tell me if and what the difference would be with Java in a
JSP page and f.e. C# in an ASP.NET page
ASP.NET uses the .NET Framework, and C# is a language which can be used to
program against the .NET Framework.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #2

P: n/a
There are two ways of creating code in ASP.Net. One is inline scripting,
which you are seeing. There, technically, it's not scripting as you
remember, but you would use the language of your choice - either VB.Net or
C# - so when you see VB - it's VB.Net coding - not VBScript, as it was in
Classic ASP days.

The other way that quite a few people use is 'code-behind', which is a
separate page for the coding, and it's tied to the ASPx page in the Page
directive

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"Marc" <m,we******************@nki.nlwrote in message
news:ew**************@TK2MSFTNGP05.phx.gbl...
Comming from JSP-HTML when I hear 'script' I think of JavaScript or
perhaps VBScript. But I think in ASP.NET they mean something else? I am
bit confused now.

Reading a book I see the following:

A simple Web page may look like the following.
<!-page directives-->
<%@ Page Language="VB" %>

<!--script-->
<script runat="server">
Private Sub SayHi(ByVal sender As Object, ByVal args As EventArgs)
Response.Write("Hello " + txtName.Value) End Sub
</script>

<!--layout-->
<html>
<head<title>Say Hi Page</title</head>

<body>
<form id="form1" runat="server"<input runat="server" id="txtName"
type="text" /<input runat="server" id="btnSayHi" type="button"
value="Say Hi" onserverclick="SayHi" />
</form>
</body>
</html>

Hence script refers to a piece of Visual Basic code here. Appearantly.

My question hence are:

1. Can you use javascript in ASP.NET pages?
2. Can you use VBScript in ASP.NET pages?
3 Does 'script' refer to the .NET C# or Visual Basic code, or to what I
should call real /scripting/ lanuguage code, like code in JavaScript of
VBScript?
4 Can anyone tell me if and what the difference would be with Java in a
JSP page and f.e. C# in an ASP.NET page

Marc Wentink

N.B. The question refers to the book I am reading Self Pace Training Kit
for the 70-528 Exam written by Glen Johnsson

Jun 27 '08 #3

P: n/a

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote
>1. Can you use JavaScript in ASP.NET pages?
Yes.
But then client side, I presume?
<script runat="server"/tag.
Which means server side code, and hence code in a .NET assembly, not code in
a scripting language like JScript VBScript, et cetera, right? Actually I was
confused by calling code in server side modules script. I would, perhaps
only call client side interpreter (javascript) code script.

Thank you, thank you, & thanks
Jun 27 '08 #4

P: n/a
"Marc" <m,we******************@nki.nlwrote in message
news:eE**************@TK2MSFTNGP02.phx.gbl...
>>1. Can you use JavaScript in ASP.NET pages?
Yes.

But then client side, I presume?
That's right.
><script runat="server"/tag.

Which means server side code, and hence code in a .NET assembly, not code
in a scripting language like JScript VBScript, et cetera, right?
That's also right.
Actually I was confused by calling code in server side modules script. I
would, perhaps only call client side interpreter (javascript) code script.
I know what you mean! Microsoft's nomenclature can be very confusing at
times...

Generally speaking, when ASP.NET developers talk of "script" they are
referring to client-side, and when they talk of "code" they are referring to
server-side...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #5

P: n/a
it holdover from asp (which was script based), which used the tag to define
server script blocks.

asp.net differs from asp and jsp in the rules for <% %and <script
runat="server">. the asp.net page is compiled into a class file.

all methods and class variables must be defined in <script runat="server">
as this code is paced between the class def, and the first method definition.

you can think of all the html and <% %code as all contained in one method
call. all html is converted to a new literal.html = html, and <%%code is
generated inline. this means code in <% %must be legal inside a method def.

<%= expression %is converted new literal.html = expression
-- bruce (sqlwork.com)
"Marc" wrote:
Comming from JSP-HTML when I hear 'script' I think of JavaScript or perhaps
VBScript. But I think in ASP.NET they mean something else? I am bit confused
now.

Reading a book I see the following:

A simple Web page may look like the following.
<!-page directives-->
<%@ Page Language="VB" %>

<!--script-->
<script runat="server">
Private Sub SayHi(ByVal sender As Object, ByVal args As EventArgs)
Response.Write("Hello " + txtName.Value) End Sub
</script>

<!--layout-->
<html>
<head<title>Say Hi Page</title</head>

<body>
<form id="form1" runat="server"<input runat="server" id="txtName"
type="text" /<input runat="server" id="btnSayHi" type="button"
value="Say Hi" onserverclick="SayHi" />
</form>
</body>
</html>

Hence script refers to a piece of Visual Basic code here. Appearantly.

My question hence are:

1. Can you use javascript in ASP.NET pages?
2. Can you use VBScript in ASP.NET pages?
3 Does 'script' refer to the .NET C# or Visual Basic code, or to what I
should call real /scripting/ lanuguage code, like code in JavaScript of
VBScript?
4 Can anyone tell me if and what the difference would be with Java in a JSP
page and f.e. C# in an ASP.NET page

Marc Wentink

N.B. The question refers to the book I am reading Self Pace Training Kit for
the 70-528 Exam written by Glen Johnsson
Jun 27 '08 #6

P: n/a
INLINE

"Marc" <m,we******************@nki.nlwrote in message
news:ew**************@TK2MSFTNGP05.phx.gbl...
Comming from JSP-HTML when I hear 'script' I think of JavaScript or
perhaps VBScript. But I think in ASP.NET they mean something else? I am
bit confused now.

Reading a book I see the following:

A simple Web page may look like the following.
<!-page directives-->
<%@ Page Language="VB" %>

<!--script-->
<script runat="server">
Private Sub SayHi(ByVal sender As Object, ByVal args As EventArgs)
Response.Write("Hello " + txtName.Value) End Sub
</script>

<!--layout-->
<html>
<head<title>Say Hi Page</title</head>

<body>
<form id="form1" runat="server"<input runat="server" id="txtName"
type="text" /<input runat="server" id="btnSayHi" type="button"
value="Say Hi" onserverclick="SayHi" />
</form>
</body>
</html>

Hence script refers to a piece of Visual Basic code here. Appearantly.

My question hence are:

1. Can you use javascript in ASP.NET pages?
Yes, for client side operations you can use JavaScript. In fact, all of the
AJAX bits output JavaScript to run on the client side.
2. Can you use VBScript in ASP.NET pages?
I would not use VBScript, personally, as it limits you to IE.
3 Does 'script' refer to the .NET C# or Visual Basic code, or to what I
should call real /scripting/ lanuguage code, like code in JavaScript of
VBScript?
I am sure some call the code "script", but I would not. The reason is
"script" generally means interpreted, not compiled. By interpreted, I mean
that the code in script runs in the browser, at run time. There is no
compilation step.
4 Can anyone tell me if and what the difference would be with Java in a
JSP page and f.e. C# in an ASP.NET page
Different object models. :-)

Essentially, if you are using JSP, you have Java for your server code and
JavaScript for your client code.

In ASP.NET, you have C#/VB for your server code and JavaScript for your
client code.

You can use VBScript in either, if you are so inclined.

Underneath the hood, the thinking process behind Java (JSP) and C#/VB
(ASP.NET) are quite different. And, each has its strengths and weaknesses.

Good enough?

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************

Jun 27 '08 #7

P: n/a
the server code can be written in any .net language.

there are three out of the box (no additional installs required):
javascript.net (clr based)
c# (clr based)
vb.net (clr based)

there are couple common dynamic languages available

jscript.net (dlr based javascript - comes with silverlight)
ironpyhon (dlr based)
ironRuby (dlr based)
f# (dlr based)

you might want to look at the new mvc framework, which should replace
webforms for all enterprise programers.

-- bruce (sqlwork.com)
"Marc" wrote:
>
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote
1. Can you use JavaScript in ASP.NET pages?
Yes.

But then client side, I presume?
<script runat="server"/tag.

Which means server side code, and hence code in a .NET assembly, not code in
a scripting language like JScript VBScript, et cetera, right? Actually I was
confused by calling code in server side modules script. I would, perhaps
only call client side interpreter (javascript) code script.

Thank you, thank you, & thanks
Jun 27 '08 #8

P: n/a
re:
!javascript.net (clr based)

Is that still available ?
I don't see any option in VS 2008 to create a JScript.Net-based website.

I think that JScript.Net has been removed from our arsenal.

re:
!there are couple common dynamic languages available

With 3rd party tools, there's quite a few more.

I've been dabbling with PHP.NET, using Phalanger.

http://www.codeplex.com/Wiki/View.as...Name=Phalanger

If a PHP programmer wants to dabble with .NET, there's almost no learning curve.
Phalanger even integrates with Visual Studio.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:FE**********************************@microsof t.com...
the server code can be written in any .net language.

there are three out of the box (no additional installs required):
javascript.net (clr based)
c# (clr based)
vb.net (clr based)

there are couple common dynamic languages available

jscript.net (dlr based javascript - comes with silverlight)
ironpyhon (dlr based)
ironRuby (dlr based)
f# (dlr based)

you might want to look at the new mvc framework, which should replace
webforms for all enterprise programers.

-- bruce (sqlwork.com)
"Marc" wrote:
>>
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote
>1. Can you use JavaScript in ASP.NET pages?
Yes.

But then client side, I presume?
<script runat="server"/tag.

Which means server side code, and hence code in a .NET assembly, not code in
a scripting language like JScript VBScript, et cetera, right? Actually I was
confused by calling code in server side modules script. I would, perhaps
only call client side interpreter (javascript) code script.

Thank you, thank you, & thanks

Jun 27 '08 #9

P: n/a

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote

Underneath the hood, the thinking process behind Java (JSP) and C#/VB
(ASP.NET) are quite different. And, each has its strengths and weaknesses.
Good enough?
Yes
I keep on reading the books.
:)
Jun 27 '08 #10

P: n/a
re:
!I don't see any option in VS 2008 to create a JScript.Net-based website.
!I think that JScript.Net has been removed from our arsenal.

I thought that I had seen an annoucement of that, so I looked it up...and here it is :

http://msdn.microsoft.com/en-us/vjsharp/default.aspx

<quote>
Since customers have told us that the existing J# feature set largely meets their needs
and usage of J# is declining, Microsoft is retiring the Visual J# product and Java Language
Conversion Assistant tool to better allocate resources for other customer requirements.

The J# language and JLCA tool will not be available in future versions of Visual Studio.

To preserve existing customer investments in J#, Microsoft will continue to support
the J# and JLCA technology that shipped with Visual Studio 2005 through to 2015
as per our product life-cycle strategy.
</quote>


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Juan T. Llibre" <no***********@nowhere.comwrote in message news:%2****************@TK2MSFTNGP03.phx.gbl...
re:
!javascript.net (clr based)

Is that still available ?
I don't see any option in VS 2008 to create a JScript.Net-based website.

I think that JScript.Net has been removed from our arsenal.

re:
!there are couple common dynamic languages available

With 3rd party tools, there's quite a few more.

I've been dabbling with PHP.NET, using Phalanger.

http://www.codeplex.com/Wiki/View.as...Name=Phalanger

If a PHP programmer wants to dabble with .NET, there's almost no learning curve.
Phalanger even integrates with Visual Studio.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:FE**********************************@microsof t.com...
>the server code can be written in any .net language.

there are three out of the box (no additional installs required):
javascript.net (clr based)
c# (clr based)
vb.net (clr based)

there are couple common dynamic languages available

jscript.net (dlr based javascript - comes with silverlight)
ironpyhon (dlr based)
ironRuby (dlr based)
f# (dlr based)

you might want to look at the new mvc framework, which should replace
webforms for all enterprise programers.

-- bruce (sqlwork.com)
"Marc" wrote:
>>>
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote

1. Can you use JavaScript in ASP.NET pages?
Yes.

But then client side, I presume?

<script runat="server"/tag.

Which means server side code, and hence code in a .NET assembly, not code in
a scripting language like JScript VBScript, et cetera, right? Actually I was
confused by calling code in server side modules script. I would, perhaps
only call client side interpreter (javascript) code script.

Thank you, thank you, & thanks


Jun 27 '08 #11

P: n/a
Juan T. Llibre formulated on vrijdag :
re:
!I don't see any option in VS 2008 to create a JScript.Net-based website.
!I think that JScript.Net has been removed from our arsenal.

I thought that I had seen an annoucement of that, so I looked it up...and
here it is :

http://msdn.microsoft.com/en-us/vjsharp/default.aspx

<quote>
Since customers have told us that the existing J# feature set largely meets
their needs
and usage of J# is declining, Microsoft is retiring the Visual J# product and
Java Language
Conversion Assistant tool to better allocate resources for other customer
requirements.

The J# language and JLCA tool will not be available in future versions of
Visual Studio.

To preserve existing customer investments in J#, Microsoft will continue to
support
the J# and JLCA technology that shipped with Visual Studio 2005 through to
2015
as per our product life-cycle strategy.
</quote>

Isn't J# a language that Microsoft isn't allowed to call "Java", but
looks a lot like that?
While JScript.Net is a .Net enhancement of j(ava)SCRIPT (to be run on
the server side in a ASP.Net application).
Maybe it needs to be installed specifically (as opposed to C# and
VB.Net that get installed automatically)?

Hans Kesting
Jun 27 '08 #12

P: n/a
re:
!Isn't J# a language that Microsoft isn't allowed to call "Java", but looks a lot like that?
!While JScript.Net is a .Net enhancement of j(ava)SCRIPT
!(to be run on the server side in a ASP.Net application).

J#, Visual J# and vjsharp are all the same product, which is being retired.
You can *use* J# forever, but it won't be updated any more and support will end in 2015.

JScript and JScript.Net are Microsoft versions of JavaScript.
The latest version is JScript 8.0.

You can use JScript, if the redistributable is installed,
in an .aspx page by declaring it as the page language :

<%@ language="JScript" %>

You can also use it in Webservices, if the redistributable is installed :

<%@ WebService Language="JScript" class="YourClass"%>

re:
!Maybe it needs to be installed specifically
!(as opposed to C# and VB.Net that get installed automatically)?

You *can* install the Visual J# redistributable and it will work in VS 2008.

It's here :
http://msdn.microsoft.com/en-us/vjsharp/bb188598.aspx

Support for Visual J# is not natively offered in VS 2008, though.
Visual J# was removed from Visual Studio 2008.

You don't have to install it for VS 2005, because support for it is built-in,
although only for Windows and Console programs, not for Web applications.

To add to all this jumble, there's also "Managed JScript",
which is different from JScript *and* from JScript.Net.

It's used by Silverlight.

Read about the differences between the several flavors of JScript here:
http://blogs.msdn.com/gauravseth/arc...d-jscript.aspx


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Hans Kesting" <ne*********@spamgourmet.comwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl...
Juan T. Llibre formulated on vrijdag :
>re:
!I don't see any option in VS 2008 to create a JScript.Net-based website.
!I think that JScript.Net has been removed from our arsenal.

I thought that I had seen an annoucement of that, so I looked it up...and here it is :

http://msdn.microsoft.com/en-us/vjsharp/default.aspx

<quote>
Since customers have told us that the existing J# feature set largely meets their needs
and usage of J# is declining, Microsoft is retiring the Visual J# product and Java Language
Conversion Assistant tool to better allocate resources for other customer requirements.

The J# language and JLCA tool will not be available in future versions of Visual Studio.

To preserve existing customer investments in J#, Microsoft will continue to support
the J# and JLCA technology that shipped with Visual Studio 2005 through to 2015
as per our product life-cycle strategy.
</quote>


Isn't J# a language that Microsoft isn't allowed to call "Java", but looks a lot like that?
While JScript.Net is a .Net enhancement of j(ava)SCRIPT (to be run on the server side in a ASP.Net application).
Maybe it needs to be installed specifically (as opposed to C# and VB.Net that get installed automatically)?

Hans Kesting



Jun 27 '08 #13

This discussion thread is closed

Replies have been disabled for this discussion.