locked
Error Message: BC30205: End of statement expected RRS feed

  • Question

  • User-1793215261 posted

    Hello

    I am trying to render some C# code into vb.net:

    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);
      }
    }

    I have used an online translation service which comes up with:

    Partial Class Register
        Inherits System.Web.UI.Page
    
        Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs)
            Dim accountConfirmationKey As String.Empty
               Dim ProfileCommon As String
            Dim userProfile As ProfileCommon = TryCast(ProfileCommon.Create(CreateUserWizard1.UserName), ProfileCommon)
            accountConfirmationKey = Guid.NewGuid().ToString()
            userProfile.AccountConfirmationKey = accountConfirmationKey
            userProfile.Save()
        End Sub
    
        Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As MailMessageEventArgs)
            Dim confirmLink As String = 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)
        End Sub

    There seems to be a problem with 'ProfileCommon' and with

    Dim accountConfirmationKey As String.Empty
    
    

    I get a compiler error: Error Message: BC30205: End of statement expected.

    What should I have there, please?

    Thursday, April 18, 2019 1:20 PM

Answers

All replies