I'm having difficulty transferring a c# variable to a javascript value in my aspx file. This is what I currently have:
LetsChat.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR.Hubs;
public class Default
{
public string pass = "password";
}
namespace SignalRChat
{
[HubName("myChatHub")]
public class LetsChat : Hub
{
public void send(string message)
{
Clients.All.addMessage(message);
}
}
}
Chat.aspx
<script type="text/javascript">
var pass = "<%=pass%>";
</script>
Why is it giving me the following compilation error?:
The name 'pass' does not exist in the current context
Default.Defaultclass?<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Chat.aspx.cs" Inherits="SignalRChat.Chat" %>@ Pagedirective addpartial Chatclass inheriting fromPage(inside theSignalRChatnamespace) and put yourpublic string passthere.