Hallo mensen,
Ik vroeg mij af of er iemand is die mij in de goede richting kan doen opgaan wat betreft een probleem dat ik heb met wat code. De code is niet door mijzelf geschreven ik probeer alleen maar een bug erin op te lossen.
Het probleem is als volgt, ik krijg tijdens het aanmelden van een gebruiker een foutmelding die luidt:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 103: if(LandenLijst.SelectedValue == "Nederland")
Line 104: {
Line 105: returnwaarde = v.Add(
Line 106: HttpUtility.HtmlEncode(this.tbEmail.Text),
Line 107: HttpUtility.HtmlEncode(this.tbWachtwoord
ook krijg ik tijdens het debuggen dit te zien:
int returnwaarde = 0; error: managed EE does not understand expression's syntax
if error: identifier 'if' out of scope
De code waar het probleem zich voordoet is als volgt:
private void btnVerzend_Click(object sender, System.EventArgs e)
{
int returnwaarde;
if(this.IsValid)
{
classes.Verhuurder v = new classes.Verhuurder();
if(LandenLijst.SelectedValue == "Nederland")
{
returnwaarde = v.Add(
HttpUtility.HtmlEncode(this.tbEmail.Text),
HttpUtility.HtmlEncode(this.tbWachtwoord.Text),
HttpUtility.HtmlEncode(this.tbStraat.Text),
HttpUtility.HtmlEncode(this.tbHuisnummer.Text),
HttpUtility.HtmlEncode(this.Bijvoegsel.Text),
HttpUtility.HtmlEncode(this.LandenLijst.SelectedValue),
HttpUtility.HtmlEncode(this.tbPostcode.Text),
HttpUtility.HtmlEncode(this.tbPlaats.Text),
HttpUtility.HtmlEncode(this.tbTelefoon.Text),
HttpUtility.HtmlEncode(this.tbVoornaam.Text),
HttpUtility.HtmlEncode(this.tbAchternaam.Text),
HttpUtility.HtmlEncode(this.tbFax.Text));
}
else
{
returnwaarde = v.Add(
HttpUtility.HtmlEncode(this.tbEmail.Text),
HttpUtility.HtmlEncode(this.tbWachtwoord.Text),
HttpUtility.HtmlEncode(this.StraatBuitenland.Text),
HttpUtility.HtmlEncode(this.HuisNrBuitenland.Text),
HttpUtility.HtmlEncode(this.HuisNrBijvBuitenland.Text),
HttpUtility.HtmlEncode(this.LandenLijst.SelectedValue),
HttpUtility.HtmlEncode(this.tbPostcode.Text),
HttpUtility.HtmlEncode(this.tbPlaats.Text),
HttpUtility.HtmlEncode(this.tbTelefoon.Text),
HttpUtility.HtmlEncode(this.tbVoornaam.Text),
HttpUtility.HtmlEncode(this.tbAchternaam.Text),
HttpUtility.HtmlEncode(this.tbFax.Text));
}
if(returnwaarde == 0)
{ //activatiemail verstuurd Response.Redirect("/activation/SendActivatie.aspx?Verhuurder="+tbEmail.Text);
}
else
{ //activatiemail niet verstuurd
Response.Redirect("/profiel/GebruikerBestaatReeds.aspx");
}
}
}
Ik hoop dat iemand me ene pointer kan geven, want ik moet dit zooitje dus wel aan de praat krijgen een keer
Ik heb me ondertussen rot gezocht op Internet, maar dit probleem is te veel voorkomend om een passende oplossing te vinden...
Bij voorbaat dank en met vriendelijke groet,
Dannny
Ik vroeg mij af of er iemand is die mij in de goede richting kan doen opgaan wat betreft een probleem dat ik heb met wat code. De code is niet door mijzelf geschreven ik probeer alleen maar een bug erin op te lossen.
Het probleem is als volgt, ik krijg tijdens het aanmelden van een gebruiker een foutmelding die luidt:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 103: if(LandenLijst.SelectedValue == "Nederland")
Line 104: {
Line 105: returnwaarde = v.Add(
Line 106: HttpUtility.HtmlEncode(this.tbEmail.Text),
Line 107: HttpUtility.HtmlEncode(this.tbWachtwoord
ook krijg ik tijdens het debuggen dit te zien:
int returnwaarde = 0; error: managed EE does not understand expression's syntax
if error: identifier 'if' out of scope
De code waar het probleem zich voordoet is als volgt:
private void btnVerzend_Click(object sender, System.EventArgs e)
{
int returnwaarde;
if(this.IsValid)
{
classes.Verhuurder v = new classes.Verhuurder();
if(LandenLijst.SelectedValue == "Nederland")
{
returnwaarde = v.Add(
HttpUtility.HtmlEncode(this.tbEmail.Text),
HttpUtility.HtmlEncode(this.tbWachtwoord.Text),
HttpUtility.HtmlEncode(this.tbStraat.Text),
HttpUtility.HtmlEncode(this.tbHuisnummer.Text),
HttpUtility.HtmlEncode(this.Bijvoegsel.Text),
HttpUtility.HtmlEncode(this.LandenLijst.SelectedValue),
HttpUtility.HtmlEncode(this.tbPostcode.Text),
HttpUtility.HtmlEncode(this.tbPlaats.Text),
HttpUtility.HtmlEncode(this.tbTelefoon.Text),
HttpUtility.HtmlEncode(this.tbVoornaam.Text),
HttpUtility.HtmlEncode(this.tbAchternaam.Text),
HttpUtility.HtmlEncode(this.tbFax.Text));
}
else
{
returnwaarde = v.Add(
HttpUtility.HtmlEncode(this.tbEmail.Text),
HttpUtility.HtmlEncode(this.tbWachtwoord.Text),
HttpUtility.HtmlEncode(this.StraatBuitenland.Text),
HttpUtility.HtmlEncode(this.HuisNrBuitenland.Text),
HttpUtility.HtmlEncode(this.HuisNrBijvBuitenland.Text),
HttpUtility.HtmlEncode(this.LandenLijst.SelectedValue),
HttpUtility.HtmlEncode(this.tbPostcode.Text),
HttpUtility.HtmlEncode(this.tbPlaats.Text),
HttpUtility.HtmlEncode(this.tbTelefoon.Text),
HttpUtility.HtmlEncode(this.tbVoornaam.Text),
HttpUtility.HtmlEncode(this.tbAchternaam.Text),
HttpUtility.HtmlEncode(this.tbFax.Text));
}
if(returnwaarde == 0)
{ //activatiemail verstuurd Response.Redirect("/activation/SendActivatie.aspx?Verhuurder="+tbEmail.Text);
}
else
{ //activatiemail niet verstuurd
Response.Redirect("/profiel/GebruikerBestaatReeds.aspx");
}
}
}
Ik hoop dat iemand me ene pointer kan geven, want ik moet dit zooitje dus wel aan de praat krijgen een keer

Bij voorbaat dank en met vriendelijke groet,
Dannny