Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   What is 'script' in a ASPNET file (http://www.velocityreviews.com/forums/t621174-what-is-script-in-a-aspnet-file.html)

Marc 06-19-2008 01:49 PM

What is 'script' in a ASPNET file
 
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



David Wier 06-19-2008 02:02 PM

Re: What is 'script' in a ASPNET file
 
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,wentink_remove_this_@nki.nl> wrote in message
news:ewZo0Mh0IHA.4416@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
>




Marc 06-19-2008 02:36 PM

Re: What is 'script' in a ASPNET file
 

"Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote

>> 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



bruce barker 06-19-2008 03:41 PM

RE: What is 'script' in a ASPNET file
 
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
>
>
>


Cowboy \(Gregory A. Beamer\) 06-19-2008 06:49 PM

Re: What is 'script' in a ASPNET file
 
INLINE

"Marc" <m,wentink_remove_this_@nki.nl> wrote in message
news:ewZo0Mh0IHA.4416@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! |
********************************************


bruce barker 06-19-2008 08:00 PM

Re: What is 'script' in a ASPNET file
 
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]" <mark@markNOSPAMrae.net> wrote
>
> >> 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
>
>
>


Juan T. Llibre 06-19-2008 10:16 PM

Re: What is 'script' in a ASPNET file
 
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" <brucebarker@discussions.microsoft.com> wrote in message
news:FE88202F-C585-42CF-8EB6-00AC4C3236EA@microsoft.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]" <mark@markNOSPAMrae.net> wrote
>>
>> >> 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
>>
>>
>>




Marc 06-20-2008 08:03 AM

Re: What is 'script' in a ASPNET file
 

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> wrote


> 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.
:)



Juan T. Llibre 06-20-2008 07:26 PM

Re: What is 'script' in a ASPNET file
 
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" <nomailreplies@nowhere.com> wrote in message news:%23Ey8tol0IHA.1772@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" <brucebarker@discussions.microsoft.com> wrote in message
> news:FE88202F-C585-42CF-8EB6-00AC4C3236EA@microsoft.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]" <mark@markNOSPAMrae.net> wrote
>>>
>>> >> 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
>>>
>>>
>>>

>
>




Hans Kesting 06-23-2008 03:20 PM

Re: What is 'script' in a ASPNET file
 
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




All times are GMT. The time now is 05:22 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.