jscript.net

Autoproxy configuration script parsing in .Net/C#

Hi, In order for my application (.Net 1.1) to use the system configured proxy server (trough a proxy.pac script) I was using an interop calls to WinHTTP function WinHttpGetProxyForUrl, passing the proxy.pac url I got from the registry. Unfortunately, I hit a deployment scenario, where this does not work, as the proxy.pac file is deploye...

Sharing JavaScript code between .NET desktop and browser

I have a set of core, complicated JavaScript data structures/classes that I'd like to be able to use both in the browser as JavaScript and run on the desktop with .NET 3.5. Is it possible to compile web-friendly JavaScript into assemblies that my C# code can access? Managed JScript - Is there a compiler for this available that will pr...

JScript.Net compiler error

Hi, I do the following: I create a .js file containing print("Hello World!"); I save it as hello.js I open the Visual Studio 2008 Command Prompt jsc + Enter jsc \out:hello.exe C:\path\to\my\file.js + Enter I get an E_ACCESSDENIED error: what could it be? Thanks! ...

Using JScript.NET to create WCF services?

Hi! I am trying to create a WCF service in JScript.NET. (I know, I should do it in C# or VB.NET, but humour me, please.) Has anyone done this before? I can create .asmx web services, but I'm not sure how I have to modify web.config to make the .svc file work -- do I need to precompile things? Also, I am (for right now) trying to do thi...

When creating a JavascriptConverter, how to return an array?

I'm trying to write a custom JavascriptConverter for use with a WebService I'm writing. I have to write a custom converter, because Microsoft.JScript.JSObject doesn't support IDictionary, so it gets treated as an array. I have this part working fine. However, because Microsoft.JScript.ArrayObject is a subclass of Microsoft.JScript.JSObje...

.Net Scripting Engine (C#) - Is there some sort of "header file" or "dll references file" for .Net languages?

I'm making a small scripting engine in C# and I was wondering, is there some sort of #compiler directives or some sort of other header-like file I can compile with my script files to define what Managed Dlls my script files are referencing? public static CompilerResults LoadScript( string SourceCodeFile, string[] References) { v...

Can JScript.NET be used to script a .NET application?

Since MS appears to have killed Managed JavaScript in the latest DLR for both server-side (ASP.NET Futures) and client-side (Silverlight), has anyone successfully used non-obsolete APIs to allow scripting of their application objects with JScript.NET and/or can explain how to do so? A Mono/JScript solution might also be acceptable, if i...

Includes and persistent storage in CustomRules.js of Fiddler

I've been using Fiddler for a few days now, extending CustomRules.js with my own logic. However, the file is becoming quite heavy (it's fairly heavy to begin with). I'm not very familiar with .NET or JScript, but I would like to be able to split CustomRules.js into several smaller files that I can just include into CustomRules.js. Is thi...

Help with Javascript to JScript Conversion

Background: I have data that I'm encrypting with javascript on the client side that needs to be decrypted on the server side. As far as I can tell, the javascript AES library I'm using does not interop with the C# Rijndael library. Thus, I'm left to essentially implement the javascript AES in C# for use. I'm going to try to compile ...

Why is there a conflict between variables and functions of the same name in JScript?

I have a variable named age and a function named AGE. Ignore the problem I am having with JScript beign case insensitive at the moment, i.e. age(dob) and AGE(dob) both work... Why does JScript try to use the age variable as a function? My best guess would be that jScript is treating the function declaration as both declaration and exp...

What are people using JScript.Net for?

I'm interested to know who uses JScript.Net and for what sort of applications. Whenever I'm reading MSDN .Net documentation, I always notice the JScript samples but in all the years I've been a C# dev I've never actually known anyone to use it. What sort of applications are people using this for, and how does it measure, in terms of fle...

JScript.NET private variables

I'm wondering about JScript.NET private variables. Please take a look on the following code: import System; import System.Windows.Forms; import System.Drawing; var jsPDF = function(){ var state = 0; var beginPage = function(){ state = 2; out('beginPage'); } var out = function(text){ if(state == 2){ var st = 3; } M...

Cast to delegate type fails in JScript.NET

I am trying to do async IO using BeginRead() in JScript.NET, but I can't get the callback function to work correctly. Here is the code: function readFileAsync() { var fs : FileStream = new FileStream( 'test.txt', FileMode.Open, FileAccess.Read ); var result : IAsyncResult = fs.BeginRead( new byte[8], 0, 8, readFileCallback ), f...

Why does JavaScriptSerializer return the wrong answer when called from JScript.NET?

In ASP.NET/C#: <%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Script.Serialization" %> <% JavaScriptSerializer jss = new JavaScriptSerializer(); string[] fruits = new string[3] {"apple","banana","crunchberries"}; string output = jss.Serialize(fruits); %> <html> fruits=<%=output%> </html> returns fruits=["apple","banana","c...

WPF + JScript.NET

Hi, I'm trying to compile (by using jsc.exe) javascript code which is going to run WPF window: import System; import System.Windows; import PresentationFramework; import PresentationCore; import WindowsBase; import WpfApp; App app = new App(); app.MainWindow = new Window1(); app.MainWindow.Show(); app.Run(); WpfApp is my dll with A...

Referencing and using JScript.NET "functions only" exe assembly.

I've compiled what is intended to be client-side JavaScript using the JScript compiler (jsc.exe) on the server side in an attempt to make something that can be tested from a unit testing project, and maybe even something that can be debugged on the server side. The compiled file contains only functions as follows (just for example) and...

Writing apps in JScript 5.5 instead of JScript.NET

As some of you may know JScript.NET adds quite a few features to the common JavaScript language... it adds some class syntax, some type identifier etc etc.. The main reason I use JavaScript is because I love how dynamic it is, nested function calls, variables scope etc etc... All these features seem to work fine in the .NET version, how...

JScript.NET Design IDE

I'm currently using JScript.NET for a small UI application. The problem is that my Visual Studio Express doesn't support JScript.NET for designing the UI. Is there a free IDE that I can use to design my UI and produce valid JScript.NET code? I just need the IDE Design functionality to Design the application, that's it. Currently what I...

Elmah throws exception when accessing Context.Request.ServerVariables

I'm using Elmah to log exceptions for my website, everything seems to be all working fine until one day I noticed that the 500 server errors are not being caught properly. I'm using following script to specifically ignore errors from ScriptResource.axd file. <errorFilter> <test> <or> <and> ...

List of computers in Active Directory that are online

I'm using this snippet of code to output a list of all the computers on my network (the language is jscript.net, but it's just a small manipulation of C#). var parentEntry = new DirectoryEntry(); parentEntry.Path = "WinNT:"; for(var childEntry in parentEntry.Children) { if(childEntry.SchemaClassName == "Domain") { ...