How to script C# to run HTML

Asked

Viewed 1,161 times

-7

I developed a C#(Csharp) script for web pages! But I don’t remember how to add the script tag being the C# language and not javascript.

  • NOTE: the file name would be downloads.html with the.html.Cs downloads script

  • You’re talking Asp?

  • Not only html (. html, . htm files)

  • In Asp/aspx I know but I wanted to html specifically!

  • 1

    I think in HTML does not use C# Script. I’ve seen say about Vbscript in Internet Explorer.

  • Thank you very much I thought I would use C# Script in HTML. OK!

  • @Tony but how do I make a file . aspx run as if it were html?

  • @Tony I wanted to add C# external script to my blog: http://brasilcfal.blogspot.com so I need to run C# in HTML!

  • 1

    Like this <% { Response.Write("<br>" + i.Tostring()); }%> ? but I think it only works in aspx and not in html

  • You can try using WPF or Silverlight.

Show 5 more comments

1 answer

2


You can try using Script#, http://scriptsharp.com/, a compiler that converts . Net to Javascript.

Wouldn’t it be great if you could write C# code instead of Javascript? This is possible with Script# (version 0.5.1), which is a free compiler, runtime and structure created by Microsoft software architect Nikhil Kothari. The Script# compiler takes the C# code and converts it into the equivalent Javascript code. Use Script# to create short, unitary Javascript functions or event handlers, as well as larger Javascript libraries. You can use it to create behaviors and AJAX ASP.NET components or gadgets from Windows Vista Sidebar. The Script# compiler can use files. resx to generate localized script files and can be configured to generate debug or version scripts. (Debugging scripts have blank spaces and descriptive variable names for easy reading, while version scripts have their unnecessary whitespace removed and variable renaming to simplify code compression.) In short, Script# provides all the benefits of working with C# code - compile-time errors, familiarity with the semantics and syntax of OOP in C# and better tool support - while generating the Javascript code required for the Web application or Sidebar gadgets. http://msdn.microsoft.com/pt-br/magazine/dd315418.aspx

Or the JSIL http://jsil.org/

Although it is being abandoned, in case you really want to use the C# in the browser, you can use the Silverlight

http://www.microsoft.com/silverlight/

  • is that I have enough knowledge in C# but I have little knowledge in javascript so there are things I wanted to do in html that would require javascript but I do not know!

  • 1

    At first, Javascript is not that difficult. Also, you can use ASP.Net and Signalr to communicate with your HTML client.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.