Hi again,
I tried to import it from .asmx file, it worked without complaining.
I think it is ok now, I tried to write a code that authenticate
users of a small web service through SOAP header. It seems it is working now.
I have a few question that I would like to ask you.
Do you know any good articles/books in .NET web service security, with examples?
Is there any password mask technology in
VB?
You can look at the code written below (it is an .asmx file - web service), when I run it and enter the value for password parameter the whole text of password appears, how Could I make the password hidden in this case? I do not want to use soap header here.
<%@ WebService Language="
vb" Class="ISBN" %>
Imports System.Web.Services
Imports System.Data
Imports System.Data.OleDb
Public Class ISBN
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function BookDetail(ByVal strIsbn As String) As String
ByVal strUsername As String, _
ByVal strPassword As String) As String
Dim SecurityDr As OleDbDataReader
Dim SecurityConn As OleDbConnection
Dim SecurityCmd As OleDbCommand
Dim Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Conn += Server.MapPath("Security.mdb") & ";"
Dim SQL As String = "select Username from Users where username = '"
SQL += strUsername & "' and password = '" & strPassword & "'"
SecurityConn = New OleDbConnection(Conn)
SecurityCmd = New OleDbCommand(SQL, SecurityConn)
SecurityConn.Open()
SecurityDr = _
SecurityCmd.ExecuteReader(CommandBehavior.CloseCon nection)
If SecurityDr.Read() Then
SecurityDr.Close()
Return GetBookDetails(Isbn)
Else
SecurityDr.Close()
Return "Login to library failed."
End If
End Function
Private Function GetBookDetails(ByVal strIsbn As String) As String
Dim objLibraryDR As OleDbDataReader
Dim objLibraryConn As OleDbConnection
Dim objLibraryCmd As OleDbCommand
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Library.mdb") & ";"
Dim strSQL As String = "select Title from Books where ISBN = '" & strIsbn & "'"
Dim strBookTitle As String
objLibraryConn = New OleDbConnection(strConn)
objLibraryCmd = New OleDbCommand(strSQL, objLibraryConn)
objLibraryConn.Open()
objLibraryDR = objLibraryCmd.ExecuteReader(CommandBehavior.CloseC onnection)
If objLibraryDR.Read() Then
strBookTitle = objLibraryDR(0)
Else
strBookTitle = "Book not found in the database"
End If
objLibraryDR.Close()
Return strBookTitle
End Function
End Class