|
To unlock user licenses is not an issue. I can run SQL statement to do that.
Right now, after session expires, it throws me out of the site but in the database I'm still locked. The problem is that it takes up the license and other people cannot use it until I'm completely unlocked, which we have to do manually.
RadioBeacon is complete app. and I have no code to modify or fix the problem myself. The RadioBeacon guys want us to upgrade to new version, they say it will fix the problem + more. But we have $20,000 worth of customizations, which we will lose by moving to new version.
Is there anyway I can access IIS on the server for RadioBeacon and see all the existing sessions (and values)? If the session state is more that 15 min I will run SQL statement to unlock license and kick user out, and of course destroy session.
Thank you,
|
|
|
|
|
alexfromto wrote: Is there anyway I can access IIS on the server for RadioBeacon and see all the existing sessions (and values)?
Like I said, not that I know of.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Yeah, but none of that exposes any access to a web site's Session Manager. You can set timeout values for the site, but you have no access to the individual sessions.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Yeah. You know what? The RadioBeacon has a User Report that actualy shows who's signed in and for how long. I wonder how they did it...
Thanks,
|
|
|
|
|
It's real easy to have the site store its session data in a table in the SQL server...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
vb.net
i have a form with some textboxes connected to my access-database.
when i change the text in one of the boxes, and click the update-button,my database is updated and everything is fine.
now i have an openfiledialog. the file (jpg, gif, bmp) that's selected in that dialog is shown in a picturebox. thsi has nothing to do with my database.
but whenever i open the dialog, i can't update my database any more afterwards and visual studio stops my program with some error message (i think it was, when oledataadapter was updated with datasource)
when i don't open the dialog everything works fine.
what's goin wrong? what can i do?
|
|
|
|
|
This is caused by several problems. Not the least of which is that your connection string is not using a fully qualified path to the database file. You probably have something like:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mydb.mdb
Right?
What you're doing is assuming that the database is in the current directory. The current directory can change at any time, like you've found out while using the OpenFileDialog.
Now, when the current directory changes, your next connection to the database fails because the .MDB file is no longer in the current directory. The correct way to do any kind of file access is to always specify fully qualified path names to your files, including inside connection strings. This way, none of your file access depends on the current directory being what it's supposed to be.
Public Shared Function GetConnectionString(ByVal databaseFilename As String) As String
' Build the fully qualified path to the file in the .EXE's startup folder.
Dim fp As String = Path.Combine(Application.StartupPath, databaseFilename)
Dim cs As String = String.Empty
' Check if the file exists...
If File.Exists(fp) Then
' If so, build a connection string with it...
cs = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", fp)
Else
' If not, throw an exception...
Throw New FileNotFoundException("The database file " & databaseFilename & " cannot be found in the application startup directory!")
End If
' Return the completed connection string.
Return cs
End Function
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thank you very much, i will try this later.
|
|
|
|
|
Hellow to all
i am trying to attatch a HScrollbar to a PictureBox or to a form . i am useing drawing method in the PictureBox that i don't wanna lose the painting inside them ..
thxx ..
|
|
|
|
|
microuser_2000 wrote: i am useing drawing method in the PictureBox that i don't wanna lose the painting inside them
I fail to see how a ScrollBar is going to accomplish this. How about explaining what you really trying to do and what your problem is.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
the thing is like that i have my picture box that i had in it information for this example stations names , but in some cases i have a plenty of station that wont fit all in the same picture box , so what i need is to scroll and go to the right and read the whole information ...
that's why i need scroll in my picture box ..
thank u ..
|
|
|
|
|
I have no idea how your putting this information in the picturebox, but there's an easy solution. Resize the picturebox to as big as you need it, then put it inside a Panel control and set the Panel's AutoScroll property to True. Done!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Good Morning!
Wondering if anyone could enlighten me and possibly share some code as to how to report the install status of a specific update based on it's ID (ie: MS06-035 id:5915bac3-4cbd-4e1b-9ff1-8adc4188dd22) in VB.NET using the WSUS api.
Any help would be appreciated.
JCO
|
|
|
|
|
i work in database sql server 2000 and i need to encrypt password column so that and body open data base can not read passord
what code i use to do this
ma_refay
|
|
|
|
|
Ok, I hope this helps, SHA1 encryption, with my personal little twist:
And I made it as simple as possible, as all examples you'll find are messy and ugly..
For the encryption:
***************************************************************************
Imports System.Security.Cryptography
Imports System.Text
Imports System.Data
Imports System.Data.SqlClient
Function ComputePWD()
Dim HashValue() As Byte
Dim MessageString As String = [STRING TO ENCRYPT HERE]
Dim UE As New UnicodeEncoding()
Dim MessageBytes As Byte() = UE.GetBytes(MessageString)
Dim SHhash As New SHA1Managed()
HashValue = SHhash.ComputeHash(MessageBytes)
Dim pwd = ConvertBAToString(HashValue)
Return pwd
End Function
Function ConvertBAToString(ByVal HashValue)
Dim b As Byte
Dim converted As String = ""
For Each b In HashValue
converted = converted + b.ToString
Next b
Return converted
End Function
'copyright to ii_noname_ii@hotmail.com, pls keep this line :P
*************************************************************************
INFO:
[STRING TO ENCRYPT HERE] is what you wanna encrypt
"pwd" is your encrypted result returned by function toi call...
call is like this:
VAR = computePWD()
Tell me you love me if you use this... :P
*************************************************************************
Posting how to check for password, like a login in a reply to this....
|
|
|
|
|
A verify login example, for password encrypted like above:
(same imports needed) [] = you fill in!!!
*******************************************************************
Private Sub VerifyLogin()
Dim HashValue() As Byte
Dim MessageString As String = [Password.Text]
Dim UE As New UnicodeEncoding()
Dim MessageBytes As Byte() = UE.GetBytes(MessageString)
Dim SHhash As New SHA1Managed()
HashValue = SHhash.ComputeHash(MessageBytes)
Dim pwd = ConvertBAToString(HashValue)
Dim query = "SELECT COUNT(*) FROM [User] WHERE user_username=@Username AND user_password='" & pwd & "'"
Dim objConn As New SqlConnection("[Connection string!!!]")
Dim objCmd As New SqlCommand(query, objConn)
'''' ii_noname_ii@hotmail.com is your .net god!!! :P lol
'''' Copyrights for NoNaMe !! hehe
' Create parameters
Dim paramUsername As SqlParameter
paramUsername = New SqlParameter("@Username", SqlDbType.VarChar, 25)
paramUsername.Value = [UserName.Text]
objCmd.Parameters.Add(paramUsername)
'Insert the records into the database
objConn.Open()
Dim iResults As Integer = objCmd.ExecuteScalar()
objConn.Close()
'Display the hash value for tests only
'Dim b As Byte
'For Each b In HashValue
' Response.Write(b)
' Response.Write(" ")
'Next b
If iResults = 1 Then
'The user was found in the DB
'redirect to menu and set session id
'Response.Redirect("Default.htm")
[verfify worked]
Else
'The user was not found in the DB
[FailureText.Visible = True]
[verfify didn't work]
End If
End Sub
Function ConvertBAToString(ByVal HashValue)
Dim b As Byte
Dim converted As String = ""
For Each b In HashValue
converted = converted + b.ToString
Next b
Return converted
End Function
***********************************************************************
Some of the stuff in there must be filled or adapted to your use, but this should give you a strong head start.
Tell me you love me!!!
|
|
|
|
|
what version of VB you're using?
If you're using VB.NET or 2005 there are several way you can encrypt the password(string) before you commit it to the database.
You can try this one: (VB 2005)
--------------------------------------------------------------------------------
Imports System
Imports System.IO
Imports System.Text
Imports System.Security.Cryptography
Public Class CLSxCrypter
Private Enum ENUMxChains
e_Random = 0
e_Genuine = 1
End Enum
Private Shared SEC_Key() As Byte = {4, 79, 103, 140, 6, 60, 24, 88, _
76, 77, 254, 237, 104, 117, 106, 175, _
54, 140, 255, 30, 143, 61, 39, 19, _
122, 235, 123, 158, 250, 190, 159, 224}
Private Shared SEC_IV() As Byte = {110, 121, 68, 148, 141, 195, 221, 30, _
228, 89, 223, 131, 226, 82, 177, 195}
Public Shared Function SEC_Encrypt(ByVal xPlainString As String) As String
Dim EncryptBuffer() As Byte, _
EncryptedBytes() As Byte, _
EncryptedString As String = "", _
mRijndael As New RijndaelManaged, _
ASCIIConverter As New ASCIIEncoding, _
Encryptor As ICryptoTransform, _
msEncrypt As New MemoryStream
'create encryptor
Encryptor = mRijndael.CreateEncryptor(SEC_Key, SEC_IV)
'encrypt data
Dim csEncrypt As New CryptoStream(msEncrypt, Encryptor, CryptoStreamMode.Write)
'convert the data to a byte array
EncryptBuffer = ASCIIConverter.GetBytes(xPlainString)
'write all data to the crypto stream and flush it
csEncrypt.Write(EncryptBuffer, 0, EncryptBuffer.Length)
csEncrypt.FlushFinalBlock()
'get encrypted array of bytes
EncryptedBytes = msEncrypt.ToArray
'convert the encrypted bytes in array to string
For i As Integer = 0 To EncryptedBytes.Length - 1
EncryptedString = EncryptedString & EncryptedBytes(i) & " "
Next
EncryptedString = Left(EncryptedString, EncryptedString.Length - 1)
'return the encrypted string value
Return EncryptedString
End Function
Public Shared Function SEC_Decrypt(ByVal CipherString As String) As String
Dim EncryptedStrings() As String, _
EncryptedBytes() As Byte, _
DecryptBuffer() As Byte, _
DecryptedString As String, _
ASCIIConverter As New ASCIIEncoding, _
mRijndael As New RijndaelManaged, _
Decryptor As ICryptoTransform
'create decryptor
Decryptor = mRijndael.CreateDecryptor(SEC_Key, SEC_IV)
'convert the data to a byte array
EncryptedStrings = Split(CipherString)
ReDim EncryptedBytes(EncryptedStrings.Length - 1)
For i As Integer = 0 To EncryptedStrings.Length - 1
EncryptedBytes(i) = CByte(EncryptedStrings(i))
Next
'decrypt data
Dim msDecrypt As New MemoryStream(EncryptedBytes)
Dim csDecrypt As New CryptoStream(msDecrypt, Decryptor, CryptoStreamMode.Read)
DecryptBuffer = New Byte(EncryptedBytes.Length) {}
'Read the data out of the crypto stream
csDecrypt.Read(DecryptBuffer, 0, DecryptBuffer.Length)
'Convert the byte array back into a string
DecryptedString = ASCIIConverter.GetString(DecryptBuffer)
Return DecryptedString
End Function
-------------------------------------------------------------------------------
You can change the Key and IV with yours...
Good Luck
|
|
|
|
|
i need to add wav or mp3 file to my application and control to start or stop this file playing
ma_refay
|
|
|
|
|
i work in vb.net project and my database is sqlserver 2000 i need to make package to my project(setup project)
1- i need to add the database to setup package
2- i need to add the sql server to setup package and it run automatically if there is engine in the machine we install project on it
what the software i used to do that and how
thanks alot
ma_refay
|
|
|
|
|
Hi,
In my vb.net appliction, I use MsgBoxs...
example:
Dim msg = MsgBox("Are you sure you want to delete this learning?", 4100, "confirm delete")
If msg = 6 Then
(...)
(4100 is a yes no msgbox, always on top, useful MsgBox helper: http://www.autohotkey.com/docs/commands/MsgBox.htm[^])
Now the problem:
This msgbox is a deletion confirm from a large datagrid...
But while the MsgBox is on top, u can still click on the application under, which creates errors, for example, if u click the "edit" button, then click yes on msgbox...
How can i block application while msgbox is not clicked?
|
|
|
|
|
I have to question your us of the bit values when it's much easier to read an maintain the actual Enums used by thh MsgBox. Also, you're using the SystemModal attribute, which halts access to ALL applications in the system. Not very friendly, is it?
Use ApplicationModal instead and you'll get the result you want:
Dim mbr As MsgBoxResult
mbr = MsgBox("Are you sure?", MsgBoxStyle.YesNo Or MsgBoxStyle.ApplicationModal, "Confirm Delete")
If mbr = MsgBoxResult.Yes Then
...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I get 'MsgBoxResultmbr' is not defined...
|
|
|
|
|
Put this at the top of your code:
Imports Microsoft.VisualBasic
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|