By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

Errors in Visual Studio register.aspx file

P: 56
Hello

I am getting the following compilation error in my register.aspx file:

C30456: 'GetOwinContext' is not a member of 'System.Web.HttpContext'.

This is my code:

Expand|Select|Wrap|Line Numbers
  1.  Protected Sub CreateUser_Click(sender As Object, e As EventArgs)
  2.         Dim userName As String = Email.Text
  3.         Dim manager = Context.GetOwinContext().GetUserManager(Of ApplicationUserManager)()
  4.         Dim signInManager = Context.GetOwinContext().Get(Of ApplicationSignInManager)()
  5.         Dim user = New ApplicationUser() With {.userName = userName, .Email = userName}
  6.         Dim result = manager.Create(user, Password.Text)
  7.         If result.Succeeded Then
  8.             ' For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
  9.             ' Dim code = manager.GenerateEmailConfirmationToken(user.Id)
  10.             ' Dim callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request)
  11.             ' manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=""" & callbackUrl & """>here</a>.")
  12.  
  13.             signInManager.SignIn(user, isPersistent:=False, rememberBrowser:=False)
  14.             IdentityHelper.RedirectToReturnUrl(Request.QueryString("ReturnUrl"), Response)
  15.         Else
  16.             ErrorMessage.Text = result.Errors.FirstOrDefault()
  17.         End If
  18.     End Sub
The following, from the above code, are underlined in red:

Expand|Select|Wrap|Line Numbers
  1. Context.GetOwinContext
Error: Not a member of httpContext

Expand|Select|Wrap|Line Numbers
  1. IdentityHelper
Error: it is not declared.

At the top of my file, the following are underlined in VS 2017 in green as not being necessary:

Expand|Select|Wrap|Line Numbers
  1. Imports Microsoft.AspNet.Identity
  2. Imports Microsoft.AspNet.Identity.EntityFramework
  3. Imports Microsoft.AspNet.Identity.Owin
  4. Imports Owin
Where do I go from here, please?

Thanks!
Jan 19 '19 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.