• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

Removing text in aspx file VS 2017

Bluenose

New member
Joined
May 1, 2019
Messages
2
Programming Experience
Beginner
Hello
When a new user registers on my sign-up.aspx page, he received this on-screen message: 'Your account has been successfully created. You will receive an e-mail with a confirmation link that you need to click to confirm your e-mail address and activate your account.'

I wish to remove that text as I have it on another page the user is redirected to called success_test.aspx. When I have tried to remove the text on my sign-up.aspx page, I got a server error in Visual Studio 2017.
This is the aspx code I have on my sign-up page:


C#:
<form id="form1" runat="server">
  <div>

      <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" DisableCreatedUser="True" OnCreatedUser="CreateUserWizard1_CreatedUser" OnSendingMail="CreateUserWizard1_SendingMail" CompleteSuccessText="Your account has been successfully created. You will receive an e-mail with a confirmation<br>
    link that you need to click to confirm your e-mail address and activate your account.">

  <MailDefinition BodyFileName="~/App_Data/YourNewAccount.txt" From="info@mysite.net" Subject="Your new account">
  </MailDefinition>
  <WizardSteps>
    <asp:CreateUserWizardStep runat="server" />
    <asp:CompleteWizardStep runat="server" />
  </WizardSteps>
</asp:CreateUserWizard>
</div>
  </form>
and this is in my aspx.cs file:

C#:
public partial class SignUp : System.Web.UI.Page
{
  string accountConfirmationKey = string.Empty;

  protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
 
    {
        ProfileCommon userProfile = ProfileCommon.Create(CreateUserWizard1.UserName) as ProfileCommon;
        accountConfirmationKey = Guid.NewGuid().ToString();
        userProfile.AccountConfirmationKey = accountConfirmationKey;
        userProfile.Save();
    }

    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        string confirmLink = string.Format("{0}://{1}/Confirm.aspx?ConfirmationKey={2}&UserName={3}", Request.Url.Scheme, Request.Url.Authority, accountConfirmationKey, CreateUserWizard1.UserName);
        e.Message.Body = e.Message.Body.Replace("##ConfirmLink##", confirmLink);
    }

}
Any help would be appreciated.

Thanks!
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
50
Location
Virginia Beach, VA
Programming Experience
10+
What is the exact error you are getting?

What happens when you are running the code in a debugger?
 

Bluenose

New member
Joined
May 1, 2019
Messages
2
Programming Experience
Beginner
Thanks for your reply.

If I remove

C#:
<CompleteSuccessText="Your account has been successfully created. You will receive an e-mail with a confirmation link that

you need to click to confirm your e-mail address and activate your account.">
I can't see that the message has actually been sent. They are supposed to go in a folder of my C drive as per my Web.config:

C#:
<system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory" from="info@dimadayoub.net">
        <specifiedPickupDirectory pickupDirectoryLocation="C:\TempMail"/>
      </smtp>
    </mailSettings>
  </system.net>
but the message is not in that TempMail folder. When I put the line of code back and send the message again, it is in there.

Thanks again.
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
50
Location
Virginia Beach, VA
Programming Experience
10+
Can you just set the attribute to an empty string instead of completely removing it?

Another alternative is actually step through the code with the debugger. The source code is available at Reference Source .
 
Top Bottom