查了一下网络,有方案是在GET{}中只返回*****字符串,不返回实际密码;但如此处理的话,界面显示是能解决了,问题是内部程序处理的时候,要访问读取这个属性又比较罗嗦了,请问有什么好的解决方案吗?
解决方案 »
- 求DataSet批量导入Mssql数据库的写法
- Application.DoEvent()再一次求解!!!!
- 自定义光标的图像问题
- 送分咯!集思广益,先到先得!!!
- 将RichTextBox控件信息在网络中发送并接收的问题~~~~~~~~
- 请问MenuStrip中的 ToolStripMenuItem下面的DropdownItem可以有两列以上吗?
- c#调用dll,int*,long*转换成什么类型啊?
- 请教:VScrollBar控件为什么点击向上或向下时会两次调用Scroll事件,谢谢
- 用jmail发送邮件时,当执行到send语句时就死等
- .NET Thread类创建的线程是在CPU一个核上面还是多个核上面?
- 请问:用<location>来允许用户不登录访问某些页面时,能否批量设置?
- C#中使用jmail组件 接收html邮件
可不可以在显示的地方添加TextBox什么的
直接改变TextBox属性变为“****”就好了
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return base.CanConvertFrom (context, sourceType);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if( destinationType.GetType() == typeof(string) )
return true; return base.CanConvertTo (context, destinationType);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if( value.GetType() == typeof(string) )
{
int stringSize;
string retVal = "*";
Random randomString = new Random();
if( value != null )
stringSize = ((string)value).Length;
else
stringSize = randomString.Next( 10 ); for( int i = 0; i < stringSize; i++ )
retVal += "*"; return retVal;
} return base.ConvertTo (context, culture, value, destinationType);
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return false;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
string[] standardValues = new string[1];
int stringSize;
string retVal = "*";
Random randomString = new Random();
stringSize = randomString.Next( 10 ); for( int i = 0; i < stringSize; i++ )
retVal += "*"; standardValues[0] = retVal; return new StandardValuesCollection( standardValues );
}
} /// <summary>
/// Summary description for MyTextbox.
/// </summary>
public class MyTextbox : System.Windows.Forms.TextBox
{
[TypeConverter(typeof(PasswordStringConverter))]
public new string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
}
http://www.codeproject.com/cs/miscctrl/PropertyGridDataFormattin.asp