The name 'LoadGlobals' does not exist in the current context
The name 'LoadGlobals' does not exist in the current context
I get this during compile in Visual Studio .net 2005.
I am also getting the same type error on other lines like these below:
The name 'G_conn_string' does not exist in the current context
The name 'G_site' does not exist in the current context
---------------------------------------------------------
The default page and lincludes at the top:
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Register TagPrefix="ScitationReports" TagName="sci_head" src="sci_head.ascx" %>
<%@ Register TagPrefix="ScitationReports" TagName="global" src="global.ascx" %>
<ScitationReports:global id="ScitationReportsglobal" runat="server"></ScitationReports:global>
void Page_Load( Object sender , EventArgs e )
{
LoadGlobals ( sender , e );
}
---------------------------------------------------------
---------------------------------------------------------
Global.ascx contains the following:
<%@ Control Language="C#" ClassName="global" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script language="C#" runat="server">
struct Site {
public string site_id;
public string group_id;
public string consortia_id;
public string name;
public string publisher;
};
string G_title;
string G_conn_string = "User ID=nnnnnn;Password=nnnnn;database=Net;server=new.mmmm.com;Connection Timeout=60;";
Site G_site;
void LoadGlobals (Object sender , EventArgs e)
{
SqlConnection conAIP;
SqlCommand cmdSelect;
SqlDataReader dtrAccessControl;
SqlDataReader dtrConsortia;
SqlDataReader dtrSite;
SqlDataReader dtrGroup;
SqlDataReader dtrPublisher;
G_site.site_id = "";
G_site.name = "";
G_site.group_id = "";
G_site.publisher = "";
conAIP = new SqlConnection( G_conn_string );
try {
conAIP.Open();
if ( Page.User.Identity.IsAuthenticated ) {
cmdSelect = new SqlCommand("select site_id from AIPSite_Access_Control where user_id = '" + Page.User.Identity.Name + "'", conAIP);
dtrAccessControl = cmdSelect.ExecuteReader();
while ( dtrAccessControl.Read() ) {
G_site.site_id = dtrAccessControl["site_id"].ToString();
}
dtrAccessControl.Close ();
if ( ( string.Compare ( G_site.site_id, string.Empty ) != 0 ) && ( ((string)Session["loginchk"]) != "publisher") ) { // site
cmdSelect = new SqlCommand( "select site_name from AIPSites where site_id = '" + G_site.site_id + "'", conAIP );
dtrSite = cmdSelect.ExecuteReader();
while ( dtrSite.Read () ) {
G_site.name = dtrSite["site_name"].ToString();
}
dtrSite.Close ();
cmdSelect = new SqlCommand ( "select group_id from AIPGroup_Members where site_id = '" + G_site.site_id + "'", conAIP );
dtrGroup = cmdSelect.ExecuteReader();
while ( dtrGroup.Read() ) {
G_site.group_id = dtrGroup["group_id"].ToString();
}
dtrGroup.Close ();
} else { // consortia
cmdSelect = new SqlCommand("select consortium_id from AIPConsortia_Access_Control where user_id = '" + Page.User.Identity.Name +
"'", conAIP);
dtrAccessControl = cmdSelect.ExecuteReader();
while ( dtrAccessControl.Read() ) {
G_site.consortia_id = dtrAccessControl["consortium_id"].ToString();
}
dtrAccessControl.Close ();
cmdSelect = new SqlCommand( "select consortium_name from AIPConsortia where consortium_id = '" + G_site.consortia_id + "'", conAIP );
dtrConsortia = cmdSelect.ExecuteReader();
while ( dtrConsortia.Read () ) {
G_site.name = dtrConsortia["consortium_name"].ToString();
}
dtrConsortia.Close ();
cmdSelect = new SqlCommand("select publisher from AIPPublisher_Access_Control where user_id = '" + Page.User.Identity.Name + "'",
conAIP);
dtrPublisher = cmdSelect.ExecuteReader();
while ( dtrPublisher.Read () ) {
G_site.publisher = dtrPublisher["publisher"].ToString();
Response.Write("<!-- pub lookup:" + G_site.publisher + " -->");
}
dtrPublisher.Close ();
}
}
}
catch (Exception ex) {
//Response.Write("<!-- exception: " + ex.Message + " -->");
}
finally {
conAIP.Close();
}
Response.Write("<!-- user=" + Page.User.Identity.Name + ";publisher=" + G_site.publisher + "; site_id=" + G_site.site_id + " -->");
}
</script>
---------------------------------------------------------