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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:27:17+00:00 2026-06-13T07:27:17+00:00

Is it possible to get the username / password in asp.net (mvc3) from a

  • 0

Is it possible to get the username / password in asp.net (mvc3) from a http url where it is formated like this?

http://user:password@example.com/path

or is it only possible with the ftp protocol?

  • 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-13T07:27:18+00:00Added an answer on June 13, 2026 at 7:27 am

    The username and password in your example are using HTTP Basic Authentication – they aren’t part of the URL but rather included in the header information. You can access this info in ASP.NET, see this article: Basic Authentication with Asp.Net WebAPI

    public class BasicAuthenticationAttribute : System.Web.Http.Filters.ActionFilterAttribute {
        public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext) {
            if (actionContext.Request.Headers.Authorization == null){
                // No Header Auth Info
                actionContext.Response = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.Unauthorized);
            } else {
                // Get the auth token
                string authToken = actionContext.Request.Headers.Authorization.Parameter;
                // Decode the token from BASE64
                string decodedToken = Encoding.UTF8.GetString(Convert.FromBase64String(authToken));
    
                // Extract username and password from decoded token
                string username = decodedToken.Substring(0, decodedToken.IndexOf(":"));
                string password = decodedToken.Substring(decodedToken.IndexOf(":") + 1);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I read the username and password from http GET in .NET MVC
Possible Duplicate: Get URL of ASP.Net Page in code-behind I'm trying to hold current
Is it possible to get username and password from windows form and send them
Take for example this $username = mysql_real_escape_string($_GET['username']); $password = mysql_real_escape_string($_GET['password']); $sql = SELECT *
Possible Duplicate: Get file name from URI string in C# How to extract file
Possible Duplicate: Get the resolution of a jpeg image using C# and the .NET
Possible Duplicate: Get all files from VSS for a given date? I need to
Possible Duplicate: Get a list of dates between two dates This is my sql:
We are planning on using ASP.Net MVC3 to create a JSON API. For handling
I've searched on this and I'm still not sure. In asp.net, I can programmatically

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.