namespace ASPMultilingual {
public partial class _Default : System.Web.UI.Page
{
ResourceManager rm;
CultureInfo ci;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Lang"] == null) {
Session["Lang"] ="en-US";
}
if (!IsPostBack)
{
LoadString();
}
}
private void LoadString(){
Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Lang"].ToString());
//rm = new ResourceManager("ASPMultilingual.App_GlobalResources.Lang", Assembly.GetExecutingAssembly());
ResourceManager rm = new ResourceManager("ASPMultilingual.Lang", System.Reflection.Assembly.Load("ASPMultilingual"));
ci = Thread.CurrentThread.CurrentCulture;
btnLogIn.Text = rm.GetString("Login", ci);
}
protected void btnLogIn_Click(object sender, EventArgs e)
{
string ID = Request.Form["txtID"];
String password = Request.Form["txtPassword"];
string strConString = ConfigurationManager.ConnectionStrings["SOConnectionString"].ConnectionString;
OleDbConnection conn = new OleDbConnection(strConString);
OleDbCommand cmd = new OleDbCommand("SELECT * FROM USERMASTER", conn);
try
{
conn.Open();
OleDbDataReader dr;
dr = cmd.ExecuteReader();
while (dr.Read()) {
string testposition = dr["UserPosition"].ToString();
string dataID = dr["UserId"].ToString();
string dataPass = dr["UserPwd"].ToString();
if (dataPass == txtPassword.Text && dataID == txtID.Text)
{
Session["User_Position"] = testposition;
Response.Redirect("Default2.aspx");
}
else {
lblError.Text = "Invalid account! Please Enter again!";
}
}
}
catch (Exception ex)
{
txtID.Text = "ex";
lblError.Text = ex.ToString();
}
finally
{
conn.Close();
conn.Dispose();
}
//Response.Redirect("Default2.aspx");
//ClientScript.RegisterStartupScript(this.GetType(), "yourMessage", "alert('" + ID + " " + password + "');", true);
}
protected void ddLang_SelectedIndexChanged(object sender, EventArgs e)
{
Session["Lang"] = ddLang.SelectedValue;
LoadString();
}
}
}
The code running fine until I wich to add namespace on top of the code then its throw me the error.
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message:
ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error: Line 19: public partial class _Default
You need to add namespace before class name in aspx page in inherits
attribute.
<%@ Page Title="Some Title" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="ASPMultilingual._Default" %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With