I'm going to assume ASP.NET WebForms and not MVC...
if you have in your page.aspx
a variable named:
public string myProfile = "profile1";
you will be able to pick that up in your HTML just like anything else:
<% Response.Write( myProfile ) %>
in javascript you can do the same:
<script>
var myProfile = '<%= myProfile %>';
</script>
You can also call methods:
in your page.aspx
public string getUserName() {
return String.Format("{0} {1}", User.fname, User.lname);
}
in your javascript
<script>
var myProfile = '<%= getUserName() %>';
</script>
Remember that you need to decorate your variables and methods public
ly, as if not, by default they will be private
and not accessible from outside the scope of your code behind file.