including a javascript file

G

Guest

I am using asp.net with a C# code behind and I need to figure out how to
include a javascript file for use with my code.

It was simple to do this in classic ASP: <!-- #include File="md5.js" -->

Is there a similar way in ASP.NET?

Thanks, Justin.
 
M

Marina

You can still include files.

You can also do it by declaring a script block and setting its source to a
JS file.
 
G

Guest

So, I can use <!-- #include File="md5.js" --> in the C# code behind or do I
have to put it in the .ASPX header? I the later is the case how does the c#
code access the js file?
 
R

Random

Get used to not using include files with .NET. Use <script
language="javascript" type="text/javascript" src="~/md5.js" /> instead.
This would be in the page content, by the way, not the code behind.
 

Ask a Question

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

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top