Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8426715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:36:20+00:00 2026-06-10T04:36:20+00:00

I tried to get the current user Id through the User.Identity but in vain,

  • 0

I tried to get the current user Id through the User.Identity but in vain, i found This post
that guided me to do the following : Guid userGuid = (Guid)Membership.GetUser().ProviderUserKey;

i went through the same mistake as in This Post! however the solution provided didn’t work in my case. I have an accounts model as

 public class Account
{

    public int ID { get; set; }
    ......

}

i want to link the billing information created to the currently logged in user
so i tried doing the following as suggested

 if (User.Identity.IsAuthenticated)
            {
                Guid userGuid = (Guid)Membership.GetUser().ProviderUserKey;
                billinginfo.User = db.AccountSet
                                   .Where(x => x.ID == userGuid).FirstOrDefault();  
            }

and i have the obvious error :

Operator ‘==’ cannot be applied to operands of type ‘int’ and ‘System.Guid’
i couldn’t get an answer from This Post
i tried to convert the Guid to int but that generated a wrong id since the conversion is utmost to 64 bits

So i want to get the currently logged in user and be able to access all his attributes

Any help is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:36:22+00:00Added an answer on June 10, 2026 at 4:36 am

    You cannot compare integer with a GUID. It doesn’t make sense. In order to relate the 2 tables you will have to use the same datatype column in both of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When i tried to get the current location of a user via FQL, Graph
I am trying to get current running context in android, I tried to use:
I tried to get the SLDeviceVolumeItf interface of the RecorderObject on Android but I
I tried to get avatar at single (post) page by these codes <?php echo
I tried to get my application run at a specified time but I can't
I have tried to get tsung to work on ec2 but to no avail.
In my current application I have a form that requires the user to enter
I'm having a time trying to get this nested model working. I've tried all
I have the following relationships: user.rb has_many :ownerships has_many :restaurants, :through => :ownerships restaurant.rb
I have the following models: class Post < ActiveRecord::Base has_and_belongs_to_many :countries end class User

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.