|
The only way I can see that being done is if you can actually get a reference to the actual method caller, and call GetType() on it.
AFAIK, the stack frame only keeps a record of method calls, and not the caller instances, so sorry, we're both out of luck.
|
|
|
|
|
Yeah, that's how it seems to be. But it sure would seem to make more sense the other way. If I am executing Derived.Method, then the frame should have a Derived.Method even though Method is declared in Base and not overridden. I mean come on, is it inherited or not?
It's not affecting me very much, I just need to walk back along the stack a little further to find an actual method that's declared in the derived class in order to find the attribute.
P.S. Did you run into the same thing? Do you have a workaround?
|
|
|
|
|
I don't have a workaround for it since I really didn't need to examine the caller for any embedded attributes. The only only workaround I could see for that is if you were to manually add type information that states which method calls which--and that would be one ugly hack to pull off.
|
|
|
|
|
Could any one please help me to get the real use of Window handlers. And Please give me an example to use it in ASP.Net application.
Thank you.
VB.Net,ASP.Net, VB, ASP, Database
|
|
|
|
|
What do you mean by "Window handler"?? There are Window "Handles", which is just a numeric identifier of a Window for use in Win32 applications. They don't apply to ASP.NET apps. There are also window message handlers, but again, they don't apply to ASP.NET apps.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Keep the conversation in the forums. Do NOT hit the Email link. I don't care what your personal email is and will not respond to it.
Mr. Dave
I am sorry I put the correct question or not. What I want is here clearly. Thank you if you could give me the reply immediately.
"I am able to open a seperate window using buttin click and few lines of java/vb script code. But I am unable to pass the values of the second or child window browser to the first browser or the parent browser. Can any one you advice me or give me a little much of code to achieve this task.
you can mail me to my personnal email: xxxxxxxx@gmail.com, xxxxxxxxxxxxx@akebonosoft.com"
I put this question because, I can do it using window(event) handlers in Windows application. But in ASP.Net I dont know how to do it.
Aleem.
Passing values between browser windows has nothing to do with the .NET Framework. It's done entirely in Java script, which is something outside of my realm of experience. You might want to post this question in the ASP.NET Forum.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
Can someone tell me if there is a simple way of finding all descendents of a given class in an application?
Or, is it best to use reflection to run through all classes in the currently loaded assemblies and check if they inherit from the class that I'm interested in?
In essence, what I want to do is this:
I have a base class : MyBaseClass
I inherit 'N' classes from it : MyNewClass1 , MyNewClass2 ... MyNewClassN
A 'plugin' assembly inherits some more : TheOtherClass1 , TheOtherClass2
I'd then like to be able to get a list of all the loaded classes that inherit from MyBaseClass ...
Cheers
Shaun
|
|
|
|
|
A class contains no information about it's descendents. You have to check each class for inheritance.
---
b { font-weight: normal; }
|
|
|
|
|
That's kind of what I thought. I ended up going through the classes in each assembly and checking that they were descended from the correct class.
Thanks
Shaun
|
|
|
|
|
hi all
is there any idea about jabber messanger,,
i want to create my own jabber chat server and client messanger ,, whre to statrt ,,, what is required ? can any one explain me the right way to follow ,, any help plz
thanks in advance
hello
|
|
|
|
|
The right way is to scope out the project from a "blue sky" point of view and work your way down, getting more detail on every level.
|
|
|
|
|
We see more and more text boxes that contain a faded text to help the user enter the right information. A good example you could have a text box wuith a label "Email" and faded in the text box we could have something like "YourAddress@yourdomain.com" to help the user. Normally as soon as data in entered , this information disapears and is never seen again. I think it is called shadowing. .NET Windows forms doesn't seem to support this, or did I miss something.
|
|
|
|
|
A website that has a control like what you are looking for is: XP Common Controls (XPCC)[^]
This site has a control that can give the shadowed text called a XPCueBannerExtender. The description on the site: The CueBannerExtender allows you to display a grayed text inside a textbox or group box that will vanish when the control gets the focus. Because this is an extender control you can simply place it onto your form and add the CueBannerText to display to each textbox and groupbox you wish.
However if you do use other controls on this site such as the XPLetterBox and XPLoginEntry. Please consider using my XP Logon Control[^] that is based off of both of the controls and adds some other user interface enhancements.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
This effect can be fairly easily done.
Use the designer to add some sample text like email address and change the coloer to your light grey color. The designer will look like something lke:
Me.TextBox1.ForeColor = System.Drawing.Color.Silver
Me.TextBox1.Text = "Sample text"
As soon as the user starts to type in the text box you want the text to clear and the color to change. So handle a couple possible events like this:
Private m_bFirst As Boolean = True
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If m_bFirst Then
'clear the text
TextBox1.Text = ""
TextBox1.ForeColor = Color.Black
End If
End Sub
Private Sub TextBox1_MouseDown(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles TextBox1.MouseDown
If m_bFirst Then
'clear the text
TextBox1.Text = ""
TextBox1.ForeColor = Color.Black
End If
End Sub
I have just made these changes to the form where I was using the text box. If you wanted to use this style more then once you could make a custom control.
|
|
|
|
|
I wanted to avoid wriring but it's not too long to do so let's get busy !
|
|
|
|
|
Hi.
I need to ecncrypt password and store it in DB for later use. How do I do that?
I use System.Security.Cryptography.RijndaelManaged to encrypt password (please see code below). Here's where I'm stack. How do I save it in DB and how do I decrypt it later on as well? I generate IV and key to encrypt password but I'm sure I need to keep them for later use somehow. I will need to decrypt password back when user returns.
Please help.
<br />
Dim original As String = txtPassword.Text<br />
Dim myRijndael As New RijndaelManaged<br />
Dim encrypted() As Byte<br />
<br />
Dim key() As Byte<br />
Dim IV() As Byte<br />
<br />
'Create a new key and initialization vector.<br />
myRijndael.GenerateKey()<br />
myRijndael.GenerateIV()<br />
<br />
'Get the key and IV.<br />
key = myRijndael.Key<br />
IV = myRijndael.IV<br />
<br />
key = myRijndael.Key<br />
IV = myRijndael.IV<br />
<br />
'Get an encryptor.<br />
Dim transform As System.Security.Cryptography.ICryptoTransform<br />
transform = rmcrypto.CreateEncryptor(key, IV)<br />
encrypted = transform.TransformFinalBlock(encoder.GetBytes(original), 0, encoder.GetBytes(original).Length)
|
|
|
|
|
If you create a new key for each time you encrypt a password, you have to store the key along with the encrypted password. Then it's not really any point in encrypting it, is there?
A common way of handling passwords is to not store them at all, but only store a hash code of the password. That way noone can ever decrypt the password. When you need to check the password, you get the hash code of the entered password and compare it to the stored hash code.
The GetHashCode method of the string class is not suitable for long term storage, though. You have to use a consistently defined algorithm, like for example MD5.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks. I kinda thought about it too. Here's what I came up with
Function HashPassword(ByVal password As String) As String<br />
Dim hashedPassword As String<br />
Dim hashProvider As SHA256Managed<br />
Try<br />
Dim passwordBytes() As Byte<br />
Dim hashBytes1() As Byte<br />
Dim hashBytes2() As Byte<br />
passwordBytes = System.Text.Encoding.Unicode.GetBytes(password)<br />
hashProvider = New SHA256Managed<br />
hashProvider.Initialize()<br />
hashBytes1 = hashProvider.ComputeHash(passwordBytes)<br />
hashBytes2 = hashProvider.ComputeHash(hashBytes1)<br />
hashedPassword = Convert.ToBase64String(hashBytes2)<br />
Finally<br />
If Not hashProvider Is Nothing Then<br />
hashProvider.Clear()<br />
hashProvider = Nothing<br />
End If<br />
End Try<br />
Return hashedPassword<br />
End Function
|
|
|
|
|
One way is to specify the key & IV rather than generating them. Then you use the same values to decrypt.
e.g.
myRijndael.Key = keyBytes ' 32 bytes<br />
myRijndael.IV = ivBytes ' 16 bytes
"For fifty bucks I'd put my face in their soup and blow." - George Costanza ~ Web SQL Utility - asp.net app to query Access, SQL server, MySQL. Stores history, favourites.
|
|
|
|
|
I see. Do you have any example of how I can create these?
Can they be random (I mean different)?
Thanks,
|
|
|
|
|
Yep they're different.
One common way is to use the PasswordDeriveBytes class.
E.g. (in C#):
byte[] key = new PasswordDeriveBytes("secret_pass", new byte[]{ 21, 5, 85, 200, 43, 65, 44 }).GetBytes(32);<br />
byte[] iv = new PasswordDeriveBytes("secret_pass", new byte[]{ 21, 5, 85, 200, 43, 65, 44 }).GetBytes(16);
BTW those numbers are random. You can make up your own byte array. It's known as the salt .
"For fifty bucks I'd put my face in their soup and blow." - George Costanza ~ Web SQL Utility - asp.net app to query Access, SQL server, MySQL. Stores history, favourites.
|
|
|
|
|
Thanks man. I look into this. I found one way as you can see in my reply to another guy but would really like to finish what I've started.
Thanks again.
|
|
|
|
|
Hello My Dears............
I have downloaded "Network Sniffer & Connection Analyzer" code but get problem in running the code in "Microsoft Visual Studio 2005 Express Edition".....
PLZ Help me in running this code(Give details for running)..............Thanks.
khalid mahmood
|
|
|
|
|
hazarian wrote: Give details for running
How about giving details of what problem you are having?
|
|
|
|
|
This code consists of three Projects i-e "Port scanner,Sniffer,SnifferUI"......What should be the exact way of running these three projects.
khalid mahmood
|
|
|
|