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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:39:33+00:00 2026-06-12T06:39:33+00:00

Is there any secure way of setting value to textbox in password mode? I

  • 0

Is there any secure way of setting value to textbox in password mode?

I have a custom login form with a password textbox:
<asp:TextBox ID="tbPassword" runat="server" TextMode="Password"></asp:TextBox>
and on page load, I’d like to put there some remembered password I’ve decrypted in code-behind from a cookie.

95% of answers I’ve found is to set the textbox value, like:
tbPassword.Attributes["value"] = "ThePassword";

However, it’s not the most secure way, as it generates following HTML code, visible when view source, where password is stored in a plain text:

<input id="tbPassword" type="password" value="ThePassword" name="ctl00$cpMainContentParent$tbPassword">

I’ve tried different way with jQuery, setting value with:

$("#tbLogin").val("ThePassword");

It is much better, as the value is not visible in View Source, yet the password is visible in jQuery script on a page…

I’ve also tried to register client script and run it, but as I cannot “unregister” it, so result is the same as with the plain jQuery sript…

Do you know any workaround to set that value and not show it in source code?

  • 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-12T06:39:34+00:00Added an answer on June 12, 2026 at 6:39 am

    As Bob’s comment says, the whole concept is flawed. If the cookie is valid, then just skip the password prompt. If it’s not valid, then you have nothing to auto-fill with.

    That being said, there is nothing you can do to directly fill the textbox which can’t be intercepted in some way. Even if you filled it via a post-load AJAX call, the user could still see the content via something like FireBug. That’s inherent in the nature of web browsers – there’s nothing that’s secure from the browser itself, because the browser needs to understand it to render it.

    If you really want to do this, one option is to compute a custom hash of the password which incorporates the timestamp (or some other one-time value), and set the textbox to that. You’d need to accept both the standard password and the hash as valid, but the hash won’t be reusable so it won’t matter if the user sees it.

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

Sidebar

Related Questions

Possible Duplicate: PHP validation/regex for URL Is there any easy, secure and fast way
Is there any way to secure Web Methods in c# like Spring Security Annotations?
How to secure or hide javascript code on client side. Is there any way
Is there any way to use a custom html helper with the <%: %>
Is there any fast implementation of cryptographically secure pseudorandom number generator (CSPRNG) for C#
Is there any way in Notepad++ (or even with another tool) to change the
Is there any way I can set a formatter on models that will convert
Is there any way to use Google's API to retrieve a user's current zipcode
Is there any way to overload the > (greater than) operator, to be able
Is there any way we can fetch X509 Public Cetrificates using c# from AD

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.