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 1019191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:58:26+00:00 2026-05-16T10:58:26+00:00

In C# I can get the current user of a web app using the

  • 0

In C# I can get the current user of a web app using the HttpContext, however, I can’t figure out how to do this in Ruby. Is there any way of doing this?

FOR THOSE OF YOU SAYING IT IS IMPOSSIBLE, HERES PROOF:

http://www.codeproject.com/KB/aspnet/How_to_NT_User_Name.aspx

  • 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-05-16T10:58:26+00:00Added an answer on May 16, 2026 at 10:58 am

    Well, to get the current username, there’s this:

    puts ENV['USERNAME']
    

    Or go to the Win32API.

    require 'dl/win32'
    
    def get_user_name
      api = Win32API.new(
        'advapi32.dll',
        'GetUserName',
        'PP',
        'i'
      )
    
      buf = "\0" * 512
      len = [512].pack('L')
      api.call(buf,len)
    
      buf[0..(len.unpack('L')[0])]
    end
    
    puts get_user_name
    

    Edit: And I’m an idiot. This isn’t what you asked for at all. Oh well, it took me time to dig this out of my code, so it might as well stay here for anyone else wondering 😛

    Edit again: OK, it turns out I’m not an idiot after all. This is what you want. When I went back and re-read your question, the HttpContext threw me off, and I thought it was the current username from HTTP auth or something.

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

Sidebar

Related Questions

I'm trying to protect my .NET web site against CSRF attacks using a hidden
I have a web-application where the users can be sent directly to some specific
I'm trying to get a bare bones Rails app deployed under Apache, Passenger 3.0.0
I´m having trouble in creating a file and export to .yaml. I´m using Google
I'm writing a desktop app that could be used to manage a dance academy.
In this article Django templates like this {% for i in mylist %} <tr>
in my asp.net mvc project i added facebook authentication to my project. I also
Say you want to schedule recurring tasks, such as: Send email every wednesday at
I've heard that checking a hard-coded password in Flash in a big security no-no
from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class MainPage(webapp.RequestHandler):

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.