|
lol ! but it looks like school homework
|
|
|
|
|
|
Hi Experts,
I have developed this newbie pass generator system. When I click on the password generator button. It generate password for its relevant row. This is working fine when I use traces. If I remove it shows all the passwords same.
protected void PassGen_Click(object sender, EventArgs e)
{
string s,temp="";
int x;
string pass;
GridView gw = (GridView)form1.FindControl("LoginView1").FindControl("GridView1");
for (int i=0; i< gw.Rows.Count; i++)
{
CheckBox chkUpdate = (CheckBox)gw.Rows[i].Cells[0].FindControl("CheckBox1");
if (chkUpdate != null)
{
if (chkUpdate.Checked)
{
s = gw.Rows[i].Cells[6].Text;
x = 5 - s.Length;
for (int k = 0; k < x; k++)
{
temp = "0" + temp;
}
gw.Rows[i].Cells[1].Text=gw.Rows[i].Cells[5].Text + temp + gw.Rows[i].Cells[6].Text;
temp = "";
Random rand = new Random();
gw.Rows[i].Cells[2].Text = password();
}
else
{
gw.Rows[i].Cells[1].Text = "";
gw.Rows[i].Cells[2].Text = "";
}
}
}
}
private string password()
{
int d;
int maxLen = 7;
string pass="";
int i;
Random rand = new Random();
for (i = 0; i < maxLen; i++)
{
d = Convert.ToInt32(Math.Floor(rand.NextDouble() * 100));
if ((d >= 48 && d <= 57) || (d >= 65 && d <= 90) || (d >= 97 && d <= 122))
{
pass = pass + Convert.ToChar(d);}
else{
i--;
}
}
return Convert.ToString(pass);
}
}
please let me have the solutions.
Thanks & Best Regards
Jay Khatri
|
|
|
|
|
Do you bind gridview in page_load without checking postback ?
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet ds = new DataSet();
MySqlCommand comm = new MySqlCommand();
MySqlConnection conn1 = new MySqlConnection();
}
}
I use this. But whether I remove or keep. It don't make difference. I fas as I understand function is getting its value just once Or is that any time factor as trace is just like a wait / stop/pause.
Thanks
Jay Khatri
modified on Friday, May 29, 2009 8:02 AM
|
|
|
|
|
hi
I got the answer finally, I use System.Security.crytography namespace like this
private string password()
{
int d;
int maxLen = 7;
string pass="";
int i;
byte[] randomNumber = new byte[1];
RNGCryptoServiceProvider Gen = new RNGCryptoServiceProvider();
for (i = 0; i < maxLen; i++)
{
Gen.GetBytes(randomNumber);
d = Convert.ToInt32(randomNumber[0]);
//d = Convert.ToInt32(Math.Floor(rand.NextDouble() * 100));
if ((d >= 48 && d <= 57) || (d >= 65 && d <= 90) || (d >= 97 && d <= 122))
{
pass = pass + Convert.ToChar(d);}
else{
i--;
}
}
return Convert.ToString(pass);
}
|
|
|
|
|
I have to show confirm in my page.
i m using -
reponse.write("confirm('are u sure?')");
ho can i get its button value i.e. which is clicked "ok" or "cancle"
also how we can change text of these buttons that is replace ok with yes and cancle with No.
|
|
|
|
|
//write the below code in OnClientClick in aspx page
OnClientClick="return confirm('Are you sure you sure?')"
Padmanabhan
|
|
|
|
|
Say I have many control buttons in the ASP.NET developped web page, each upon being clicked will do some operatoin which may take some time, when the button is clicked, a progress bar(in my case, I used an animated gif) will be shown while keeping the web page being freezed (by word "freeze", I mean the web page will be made inactive when the progress bar is being displayed in the center of the window, the user can still see the web page, however, he cannot click on any controls in the web page, the web page will be active again until the operation completes and the progress bar disappear.)
Can anybody suggest how I may do the web page freezing?
|
|
|
|
|
You put a transparent div over the entire page.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Just create one div, set the opacity of it to 60, make position : absolute, set top and left, z-index anything greater... and you are done.
There is also a bug in IE 6 where select controls comes over the div, use Iframe to hide them as well.
|
|
|
|
|
Hi,
Plz solve me problem asap.
i am using named anchor for link, it is working fine when link is on same page.
but i want to open that link on other page,
i use :
Page1.html
<a href="link2.html#tips">Jump to the Useful Tips Section</a>
Page2.html
<a href="#tips">Content</a>
it is not working. plz help me
Thanks,
Farogh Haider
Web developer
|
|
|
|
|
Your problem is that you don't have a clue. Why would any of this code open the link on a new page ? Seriously. Buy a book on HTML and read it, or just try using google.
You may try here[^] for the answer. Or perhaps here[^].
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Thanks, for reply
Actually, i have develpoed a froum application in asp.net 2.0,
when a user click on last posted, then last posted message to be display at top(max 25 post in mypage)
how i do this?
Farogh Haider
Web developer
|
|
|
|
|
Holy crap. Did you read the links I gave you ?
farogh123 wrote: Web developer
Liar.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian Graus wrote: Liar
lol
|
|
|
|
|
|
hi,
Actually I want to create page with resolution(size) 1024*768.
Now my pc's resolution is 1440*900.
So whenever I execute prog, in 1440*900 resolution, the website will display in centre keeping some place left and right side.
and whenever I use 1024*768 resolution, it will cover whole screen, not keeping space left or right. It will be fit to screen.
How can I get this ??
I have tried a lot but I can't get this.
Plzz help me..
Thanks & regards,
Jay
|
|
|
|
|
Use % (percent) unit of measurement.
A DATAPOST COMPUTER CENTRE
(K.V Prajapati)
|
|
|
|
|
Hi Jaymm,
Setting the Width and Height in Pixels make the page dependent on resolution. If you will set the Width and Height in 100% it will not be dependent on resolution and What ever resolution you will set the page will fit on to that resolution only. Set as below
Width="100%", Height="100%"
Hope this help.
Thanks,
Mohit Jain
MCTS, MCSD.Net, MCPD.Net
|
|
|
|
|
|
hai all,
i am using the below function for password encryption.here my password is changing into encrypted form,but i dont know how to check that encrypted form password with plain text password from database?
because database contains plain text password.Please can anybody respond my question.
i wanted to use md5 in my login page.
I dont know exactly how to use it.
Public Function MD5Encryption(ByVal passwd As String) As Byte
Dim i As Integer
Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Dim hashedbytes As Byte()
Dim textencoder As UTF8Encoding = New UTF8Encoding
hashedbytes = md5.ComputeHash(textencoder.GetBytes(passwd))
md5.ComputeHash(textencoder.GetBytes(passwd))
Dim right As StringBuilder = New StringBuilder
For i = 0 To hashedbytes.Length - 1 Step 1
right.Append(hashedbytes(i).ToString("x2"))
Next i
If (right.ToString() <> passwd) Then
Response.Redirect("login.aspx")
md5.Clear()
Else
Response.Redirect("index.html")
End If
End Function
kissy
|
|
|
|
|
|
thanks for ur reply.exactly u r correct.If stored the password in encrypted form in the database can anybody know whats the password is?
if some use asking his forgotten password,then how can i tell immediately if i look at the databse.
For security purpose i wanted to encrypt,but the concept of storing encrypted password in the databse may lead to some other problem?
Pleas understand my question and answer me.
Thans once again
kissy
|
|
|
|
|
Kissy16 wrote: .If stored the password in encrypted form in the database can anybody know whats the password is?
You have some major issues.
1 - MD5 is a hash, NOT an encryption. Therefore, you have to apply MD5 to your entered password and see if the hashes match.
2 - MD5 is not very secure at all. It's better than plaintext, but not much good against a serious attacker. Your best bet is to add some salt, and hope they can't work out what that is
Kissy16 wrote: but the concept of storing encrypted password in the databse may lead to some other problem?
The concept of storing your non encrypted password leads to the problem you're trying to avoid. No two ways about it. Try thinking this through, just a little.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|