I have a string variable that contains some JavaScript codes.
I want to send these codes to client as a JavaScript file attached! just like:
<script type="text/javascript" src="/lib/some.js"></script>
but this some.js
file is not exist on the server!
how can I do this in ASP.net MVC3?
You can add your string variable to your model ("MyJavascriptCode"), then simply output the contents inside a script tag on your view. Html.Raw outputs content with encoding it.