This topic is locked
[SOLVED]

 Compilation Error - Login Page

1/27/2008 4:38:11 PM
ASPRunner.NET General questions
U
umkemesic author

Hello,
I am using ASPRunner to create a login page from a user table (Labled "Sign Up).
I used this table in access and linked the ID and Password to the ID and Password that is required in another table (Add Listing). Thus, the record will not add unless the ID/Password values for the signup table are the same <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=7372&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />.
Works like a charm.
However, when I tried to take advantage of the automatic login in page in ASP runner, I get the error complile code:

Server Error in '/Project1' Application.

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: CS0103: The name 'fldUserName' does not exist in the current context
Source Error:
Line 46: try

Line 47: {

Line 48: if (UserClass.UserExist(fldUserName.Text))

Line 49: {

Line 50: lblMessage.Text = "Username" + " " + fldClient_ID_Email.Text + " " + "already exists. Choose another username.";
Source File: c:\Program Files\ASPRunner.NET4.0\projects\test\output\register.aspx.cs Line: 48


Here are my settings, which I used to generate the login page:
Create Login Page from username and password from database
Table: Sign Up
Username Field: Client ID
Password Feild: Password
-----------------------------------------------------------------------
The "Login as Guest" works like a champ, but I cannot get the registration page to work at all.
Also, what is the purpose in the "Advance Tab" between USER ID Owner ID Field and MAIN TABLE User ID Field?

U
umkemesic author 1/27/2008

For reference here is the enitre code generated by PHPRunner:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Globalization;

endregion



public partial class Register : System.Web.UI.Page

{
protected void Page_Load( object sender, System.EventArgs e)

{

//Put user code to initialize the page here

lblMessage.Text = "";
string sLoginURL = ConfigurationManager.AppSettings["LoginFile"];

if (sLoginURL == string.Empty) sLoginURL = "login.aspx";

hlBack.NavigateUrl = sLoginURL;
string sCulture = ConfigurationManager.AppSettings["LCID"];

if ( sCulture != "" )

{

int nCulture = int.Parse(sCulture);

System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(nCulture, false);

}

}
protected void btnRegister_Click( object sender, System.EventArgs e)

{

string sTable = ConfigurationManager.AppSettings["UserListTable"];

string sLogin = ConfigurationManager.AppSettings["FieldUserLogin"];

string sPassword = fldPassword.Text.Trim();

if (fldClient_ID_Email.Text.Trim() == String.Empty)

{

lblMessage.Text = "Field" + " " + sLogin + " " + "can't be blank";

return;

}
try

{

if (UserClass.UserExist(fldUserName.Text))

{

lblMessage.Text = "Username" + " " + fldClient_ID_Email.Text + " " + "already exists. Choose another username.";

return;

}

UserClass.AddUser(fldUserName.Text, sPassword);

lblMessage.Text = "Registration successful!";

pnlRegistred.Visible = false;

hlBack.NavigateUrl += "?user=" + fldClient_ID_Email.Text;

if (fldClient_ID_Email.Text != string.Empty)

{

string sNotify = "You have registered as user at http://"'>http://"; + Request.ServerVariables["SERVER_NAME"] + Request.ServerVariables["SCRIPT_NAME"] + "\nUser Name: " + fldClient_ID_Email.Text +"\nPassword: " + fldPassword.Text;

func.SendMail(fldClient_ID_Email.Text, "Notification on registering", sNotify);

}

string sEmail = ConfigurationManager.AppSettings["AdminEMail"];

if ( sEmail != string.Empty)

{

string sNotify = "new user registered at http://"'>http://"; + Request.ServerVariables["SERVER_NAME"] + Request.ServerVariables["SCRIPT_NAME"] + "\n";

sNotify += "Client ID Email: " + fldClient_ID_Email.Text + "\n";
sNotify += "Password: " + fldPassword.Text;

func.SendMail(sEmail, "Notification on registering", sNotify);

}

}

catch (Exception ex)

{

lblMessage.Text += "<p>" + "Error description" + ": " + ex.Message + "<p>";

if (ex.InnerException != null) lblMessage.Text += "InnerException: " + ex.InnerException.Message + "<p />";

}

finally

{

}

}
}

U
umkemesic author 1/27/2008

I have read the help for the login page and I noticed that the example given shows a UserID and Username field which is numerical.
I was trying to use the user's e-mail as a login (ala Myspace or Facebook).
Should I just rename the fields as UserID and Username......or add new ones? Or is there some simple code editing that will fix this? Again, I am using "Client E-mail" as the Username and User ID to login.

U
umkemesic author 1/27/2008

I have changed the tables to reflect UserID and UserName, now I get this error:
Server Error in '/Project1' Application.

The connection name 'Project1ConnectionString' was not found in the applications configuration or the connection string is empty.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The connection name 'Project1ConnectionString' was not found in the applications configuration or the connection string is empty.
Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:


  1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
    <%@ Page Language="C#" Debug="true" %>
    or:

  1. Add the following section to the configuration file of your application:
    <configuration>

    <system.web>

    <compilation debug="true"/>

    </system.web>

    </configuration>
    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.


Stack Trace:

[InvalidOperationException: The connection name 'Project1ConnectionString' was not found in the applications configuration or the connection string is empty.]

System.Web.Compilation.ConnectionStringsExpressionBuilder.GetConnectionString(St

ring connectionStringName) +3047985

ASP.register_aspx.BuildControlsds() +76

ASP.register_aspx.BuildControlContent1(Control ctrl) +49

System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12

ASP.default_master.
BuildControlContentPlaceHolder1() +101

ASP.default_master.BuildControlfrmMaster() +87

ASP.default_master.__BuildControlTree(default_master
ctrl) +102

ASP.default_master.FrameworkInitialize() +34

System.Web.UI.UserControl.InitializeAsUserControlInternal() +31

System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +2028700

System.Web.UI.Page.get_Master() +48

System.Web.UI.Page.ApplyMasterPage() +18

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +685


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

U
umkemesic author 1/28/2008

Problem Solved !!!!
I was using 4.0, I downloaded 5.1 and opened the old file and ran the build through there <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=25288&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> No errors and looks great !!!