
Martin
Members-
Posts
16 -
Joined
-
Last visited
Martin's Achievements
Newbie (1/14)
0
Reputation
-
Thanks m8, but I already found the solution myself :) Dim md5Hasher As New MD5CryptoServiceProvider Dim hashedDataBytes As Byte() Dim encoder As New UTF8Encoding hashedDataBytes = md5Hasher.ComputeHash(encoder.GetBytes(TextBox1.Text)) Dim b As Byte For Each b In hashedDataBytes Label1.Text &= String.Format("{0:X2}", b) Next b Does the trick nicely :)
-
I have used a function to MD5 hash a password, however, the results are not correct: Correct Result--> a985c9764e0e6d738ff20f2328a0644b My Result --> a985c9764ee6d738ff2f2328a0644b Correct Result--> 098f6bcd4621d373cade4e832627b4f6 My Result --> 98f6bcd4621d373cade4e832627b4f6 Private Function GetPasswordHash(ByVal Password As String) As String Dim MD5Hasher As New System.Security.Cryptography.MD5CryptoServiceProvider Dim Encoder As New System.Text.ASCIIEncoding Dim FinalString As String FinalString = ToHexString(MD5Hasher.ComputeHash(Encoder.GetBytes(Password))) Return FinalString End Function Private Function ToHexString(ByVal ByteArray As Byte()) As String Dim i, j, k As Integer Dim thisstring As StringBuilder = New StringBuilder j = ByteArray.GetLowerBound(0) k = ByteArray.GetUpperBound(0) For i = j To k thisstring.Append(Hex(ByteArray(i))) Next Return thisstring.ToString End Function I think the problem is that somewhere inside the ByteArray, it is dropping the leading 0s, as in changing: 09 to 9 And thereby screwing up the process... can anyone help? :)
-
I have a clumsy solution that will work ;) 1.) Have a primary script that copies your PDF output script to a new file with the correct PDF name. 2.) Re-direct to the PDF output page. Example: InBetween.aspx Copies and Renames PDF.aspx To ThisPDFDocument Therefore download reads: ThisPDFDocument.pdf Its not clean, but it would work - good luck :P
-
Depends if the remote server is configured to support this. There is an option under IIS to allow the viewing of directory list, however, HTTP does not natively support any command such as LIST that is implemented by FTP. The two options are: 1.) Do a "GET /" and see if it gives you a list of the files or 2.) Work out what files are available by manually parsing the HTML as suggested by Splice. :)
-
The other way to do passwords is to make them based on an encryption algorithm (use name as key or something), but if you are seriously worried about people reversing your code and taking the password, then this isnt going to help either because they can modify the JMP that takes them to the "wrong password" dialog and then bypass your security like that....
-
connection to a mysql database on a server
Martin replied to hawk1ns's topic in Database / XML / Reporting
I can recommend http://www.stardeveloper.com/articles/display.html?article=2003052201&page=1 as a great starting place for connecting to MySQL servers, although this mainly deals with setting up MySQL - read page 9 onwards. Issues you may experience when trying to connect to MySQL databases mostly arise from imports to the System.Data.ODBC class, which I have not resolved so I use Microsoft.Data.ODBC. Ignoring this complication you can use: <%@ Page Language="C#" AutoEventWireup="False" EnableSessionState="False" EnableViewState="False" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.Odbc" %> <script runat="server"> private const string ConnStr = "Driver={MySQL ODBC 3.51 Driver};" + "Server=localhost;Database=test;uid=root;pwd=yourpassword;option=3"; protected override void OnInit(EventArgs e) { base.OnInit(e); using(OdbcConnection con = new OdbcConnection(ConnStr)) using(OdbcCommand cmd = new OdbcCommand("SELECT * FROM Names", con)) { con.Open(); dgrAllNames.DataSource = cmd.ExecuteReader( CommandBehavior.CloseConnection | CommandBehavior.SingleResult); dgrAllNames.DataBind(); } } </script> <html> <head> <title>Displaying Records from MySQL 'Names' table</title> <style> body { font: 100% Verdana; } </style> </head> <body> <p align="center">All records in the 'Names' table:</p> <asp:DataGrid ID="dgrAllNames" HorizontalAlign="Center" CellPadding="3" Runat="server" /> </body> </html> But that will need configuring ;) Now, to answer your specific questions :p: 1.) Server address and port: eg: 127.0.0.1 Port: 1234 2.) User password is of the database itself. eg: username: root password: whatever 3.) Yes :) Hope this helps a little. :) -
Maybe it would be simpler, but the MSI would slow things down too much I think :(
-
ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "picture")) Dont think that is the way to do it.... I have written this kind of BLOB handler in the past and doen it by creating an ASP.NET program to output the result and used an OutPutStream to create the output: Response.OutputStream.Write(ThisRow.Item("UploadPic"), 0, CInt(ThisRow.Item("UploadSize"))) If you did something along these lines, you could then do: ImageUrl='ShowPic.aspx' The other options is to figure out why its trying to cast a byte to a string :P Hope that helps a bit :)
-
To those who take programming classes in college (or have)
Martin replied to wyrd's topic in Water Cooler
I have been forced to learn Java as my language for my college course, I do not like it at all, however, it is perfect for the role that it is supposed to show, ie the role of a cross platform, heavily object orientated language. All in all, Id have to say that there is a big difference between what you learn at college and what you will use in the real world. But the teaching at college may prove inavluable in learning the real word stuff, it will teach you concepts and ideas that will allow you to write more efficient and effective real world applications. Agreed. How can the teachers be expected to learn the latest stuff to a level where they can teach it? Basically they can't. Stick with college, learn concepts. Learn real world stuff when you get to the real world. :) -
DataSet Rebinding to Create New Tables
Martin replied to Martin's topic in Database / XML / Reporting
Nerseus - thanks for the help, I think I'm going to have to do something along those lines: 1.) Build CREATE statement using DataSet 2.) Either convince it that is had an update OR just add it row by row. Thanks very much for the response, maybe Microsoft should add this to the next version of .NET framework ;P -
Including a "games programming" forum would, in my humble opinion, induce people with little experience to join the board and ask questions of a general nature ("How do I start writing a game?"), whereas those who are dedicated to writing games will post specific questions under the current headings. I know I'm new, but I couldn't help but comment. :)
-
I don't know much about Photoshop droplets, but Id assume that you would just pass the directory argument as a c:\path, rather than with a *, because what else is it going to do with a directory other than look inside it....
-
Do a search for "TCPListener" or "System.Net.Sockets" and you should come up with some helpful documents. The aforementioned is a simplified listener designed only for TCP/IP whereas if you are interested in UDP and other protocols you should take a look at "System.Net.Sockets", good luck - if I see anything I think might help, Ill post back here.
-
Have you tried giving the correct permissions to the user group used by .NET (IUSR/****) as recommended in http://www.xtremedotnettalk.com/t69426.html?
-
I would tend to use the upper method also, makes it easier to check data types of declared objects and generally looks cleaner to read.