The file get's created and records are written. Now, the problem is that this needs to be a fixed length text file. I am reading data retrieved from a stored procedure and looping through a data table to populate the text file like:
For Each Row In myDataTable.Rows myText = myDataTable.Rows(i).Item(0).ToString() & _ myDataTable.Rows(i).Item(1).ToString() & _
get a fixed length regardless what is filled from my data table?
Actually i am creating 1 sofware in which i need to print bill. On that bill my page header (company's name) is constant & on Report footer (companys rule & some more data) is also constant. & my Detail section is varying. On bill if data is short, my footer goes upside.
I need to fixed my detail section so that position of detail section will be maintained.
I need to fixed my footer section so that position of footer section will be maintained.
now which is the solution form above 2? . and how to implement?
Note: that's bogus base-64 text there. I've got base64_encode and decode functions that round-trip correctly. Here's my attempt, which doesn't work: SELECT UserName, Password, dbo.base64_encode(HASHBYTES('SHA1', dbo.base64_decode(PasswordSalt) + 'test')) As TestPassword FROM aspnet_Users U JOIN aspnet_membership M ON U.UserID = M.UserID
I've tried a number of variations on the theme, to no avail. I need to do this in pure T-Sql; involving a console app or something like that will double the work. So if anyone can supply what precisely the syntax should be to duplicate that password from the ASP.Net membership stuff
i m trying to change my password. the password in database is in hash formatting. the class FormsAuthentication. is using for hash conversion. the password is indicating the same in if condition. but after if applying it suddenly go on else part , even the value on if condition is same.
I am rewriting my PHP website into C# .NET, and I need to be able to set the algorithm used by the CreateUserWizard / Membership Provider to SHA1 so that I can port all of the user accounts over without having to force them all to reset their passwords when this project is complete. At current glance it doesn't look like it is using SHA-1, and my Googlefoo is failing me.
I am trying to insert a string and random number into the database as hash sha1 then loggin in against it. the problem is if I use hash it wont login but if i dont use hash the login works fine... Code below.
insert hash into db Dim user As New Label user.Visible = False user.Text = (myDataReader2.Item("username")) MyConnection2.Close() Dim MyConnection3 As New Data.SqlClient.SqlConnection("Data Source=xxx") Dim mycommand3 As New Data.SqlClient.SqlCommand("Update Register SET [Password] = @password WHERE [username] = '" & user.Text & "' AND [email] = '" & email.Text & "'", MyConnection3) Dim pass As String Dim rnd As Integer, randomNum As New Random rnd = randomNum.Next(1000, 10000) pass = "Pass" & rnd mycommand3.Parameters.AddWithValue("@password", FormsAuthentication.HashPasswordForStoringInConfigFile(pass, "SHA1")) MyConnection3.Open() mycommand3.ExecuteNonQuery() login page Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) ' Fires upon attempting to authenticate the use If Not (HttpContext.Current.User Is Nothing) Then If HttpContext.Current.User.Identity.IsAuthenticated Then If TypeOf HttpContext.Current.User.Identity Is FormsIdentity Then Dim fi As FormsIdentity = CType(HttpContext.Current.User.Identity, FormsIdentity) Dim fat As FormsAuthenticationTicket = fi.Ticket Dim astrRoles As String() = fat.UserData.Split("|"c) HttpContext.Current.User = New GenericPrincipal(fi, astrRoles) End If End If End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim myConnection As New SqlClient.SqlConnection Dim myCommand As New SqlClient.SqlCommand Dim intUserCount As Integer Dim strSQL As String myConnection = New SqlClient.SqlConnection("Data Source=jrome2.db.4961680.hostedresource.com; Initial Catalog=jrome2; User ID=jrome2; Password=Richard050283;") strSQL = "SELECT COUNT(*) FROM Register " _ & "WHERE UserName='" & Replace(txtusername.Text, "'", "''") & "' " _ & "AND Password='" & Replace(txtpassword.Text, "'", "''") & "';" myCommand = New SqlClient.SqlCommand(strSQL, myConnection) myConnection.Open() intUserCount = myCommand.ExecuteScalar() myConnection.Close() 'Response.Write(intUserCount) If intUserCount > 0 Then FormsAuthentication.Initialize() Dim strRole As String = AssignRoles(txtusername.Text) 'The AddMinutes determines how long the user will be logged in after leaving 'the site if he doesn't log off. Dim fat As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _ txtusername.Text, DateTime.Now, _ DateTime.Now.AddMinutes(30), False, strRole, _ FormsAuthentication.FormsCookiePath) Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName, _ FormsAuthentication.Encrypt(fat))) Response.Redirect(FormsAuthentication.GetRedirectUrl(txtusername.Text, False)) Else login.Text = "Incorrect Log In Information" End If End Sub Private Function ValidateUser(ByVal strUsername As String, ByVal strPassword As String) _ As Boolean 'Return true if the username and password is valid, false if it isn't Return CBool(strUsername = " & Replace(txtusername.Text, " AndAlso strPassword = " & Replace(txtpassword.Text, ") End Function Private Function AssignRoles(ByVal strUsername As String) As String Dim myConnection As New SqlClient.SqlConnection Dim myCommand As New SqlClient.SqlCommand Dim intUserCount As Integer Dim strSQL As String myConnection = New SqlClient.SqlConnection("Data Source=jrome2.db.4961680.hostedresource.com; Initial Catalog=jrome2; User ID=jrome2; Password=Richard050283;") strSQL = "SELECT COUNT(*) FROM Register " _ & "WHERE UserName='" & Replace(txtusername.Text, "'", "''") & "' " _ & "AND Password='" & Replace(txtpassword.Text, "'", "''") & "';" myCommand = New SqlClient.SqlCommand(strSQL, myConnection) myConnection.Open() intUserCount = myCommand.ExecuteScalar() myConnection.Close() 'Response.Write(intUserCount) If intUserCount > 0 Then Return "client" Else Return String.Empty End If End Function Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) txtusername.Text = String.Empty txtpassword.Text = String.Empty End Sub
I am tasked with a project to convert words from strings to numbers . I have to do this while ensuring collision-avoidance. i.e training -> 10232323
We are storing the numbers in a database and when we retrieve the records from the database, we will reverse hash and convert the number back to a string 10232323 -> training
As you might have guessed - this is not an area that I am familiar with. I researched the overridable System.Object.GetHashCode() method, but Microsoft warns that there is little guarantee that the default implementation of GetHashCode() avoids collisions.
So I am left stuck. I would like to create an algorithm, but I have no idea where to start.
Also, the function should accept unicode characters - in the event the company decides to internationalize.
When i try to encrypt it goes fine.. but when i right after try to decrypt it i get an:"Length of the data to decrypt is invalid" error... the error occours when i try to run the code FlushFinalBlock();here is my code:
I am using Forms Authentication in a new ASP.NET 3.5 Application.I have created the Tables in my database and run the Web Site Administration Too.When I try to create a user I get a password error no matter what I throw at it and I am becoming sure of that this is a symptom of an a setup error and not a password problem.One of the things that I notice is that my aspnet_Applications is empty and I am not sure what is supposed to fill it.I have tried to delete all the aspnet tables and done the procedure again but with the same result.
I am using encryption/decryption logic from the following link: [URL] Code from this page is working but at times, its throwing an error while decyption as 'Length of the data to decrypt is invalid'. I have a very limited knowledge on this topic so I am no able to troubleshoot it further
Since I'm new to coding and I'm trying to understand why here is a little more detail on the question.If you have a text box and you are limiting the input to say 2 charactrs do you really need to validate the input further? What I have is a text box that has a max length of 2. Is there a security reason to add a validator to the textbox. I should add this is in Asp.net.
Windows 7 Ultimate 64bit Visual Studio 2008 Team System Using C# SQL Server 2005 Express Management Studio (Service Pack 3) By using Visual Studio 2008,I opened Server Explorer and tried to modify Database connection,i wanted to use SQL Authentication,I entered User name and Passwored after pressing OK button,i got the following... Error message Failed to generate a user instance of SQL Server.Only an integerated connection can generate a user instance.The connection will be closed.