Click here to Skip to main content
15,913,298 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionNeed help populating fields from database to form in page load Pin
Bootzilla3320-Dec-16 8:51
Bootzilla3320-Dec-16 8:51 
AnswerRe: Need help populating fields from database to form in page load Pin
Richard Deeming20-Dec-16 10:18
mveRichard Deeming20-Dec-16 10:18 
QuestionViewData, Viewbag and tempdata not working Pin
Member 815484520-Dec-16 6:47
Member 815484520-Dec-16 6:47 
AnswerRe: ViewData, Viewbag and tempdata not working Pin
Richard Deeming20-Dec-16 8:09
mveRichard Deeming20-Dec-16 8:09 
GeneralRe: ViewData, Viewbag and tempdata not working Pin
Member 815484520-Dec-16 8:36
Member 815484520-Dec-16 8:36 
GeneralRe: ViewData, Viewbag and tempdata not working Pin
Richard Deeming20-Dec-16 10:11
mveRichard Deeming20-Dec-16 10:11 
QuestionASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee19-Dec-16 3:51
professionalTridip Bhattacharjee19-Dec-16 3:51 
AnswerRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx19-Dec-16 11:40
professionaljkirkerx19-Dec-16 11:40 
I did something simliar last year, in which I made a web service for a web application, that a vb.net app would access.

So on the Web Side, I made a Class but used Get Set and serialized it. And made a web service as well.
I wrote this in VB off the top of my head, I could not find any examples on how to do it and I wasn't writing C# yet.
VB
<Serializable()>
Public Class ws_subscribersCount_Request

<pre>
Private m_Credentials_Key As String
Private m_Credentials_Password As String

Public Property Credentials_Key As String
    Get
        Return m_Credentials_Key
    End Get
    Set(value As String)
        m_Credentials_Key = value
    End Set
End Property

Public Property Credentials_Password As String
    Get
        Return m_Credentials_Password
    End Get
    Set(value As String)
        m_Credentials_Password = value
    End Set
End Property

End Class

<webmethod(enablesession:=true)> _
Public Function subscribers_count( _
ByVal SubscribersRequest As ws_subscribersCount_Request) As ws_subscribersCount_Response

Dim subscribers As New ws_subscribersCount_Response

Dim dwXCode As Integer = crm_ef_login.administrator_Login(
SubscribersRequest.Credentials_Key,
SubscribersRequest.Credentials_Password
)

If (0 = dwXCode) Then

Dim m_count As Integer = crm_ws_ef_subscribers.subscribers_Count()

If (m_count > 0) Then

subscribers.response_Code = "OK"
subscribers.response_Text = m_count & " subscribers have loaded successfully"
subscribers.count = m_count

Else

subscribers.response_Code = "E001"
subscribers.response_Text = "No subscribers exist in the database"
subscribers.count = 0

End If

Else

subscribers.response_Code = "E000"
subscribers.response_Text = "Failed Authentication"
subscribers.count = 0

End If

Return subscribers

End Function


Then on the client side, I registered a Service Reference by running the web app in debug, and then using VS to register the asmx file,

Add Service Reference
find the asmx file using a browser and copy the address, then paste the address into the client address textbox and add ? WSDL to it
http://localhost:7591/smtpMessenger.asmx?WSDL

This will turn the URL into a WSDL or SOAP class in the console app your testing or writing.
Then in the client app, this is how you handle the call
VB
Public Shared Function get_Subscriber_Count( _
        ByRef pResult As crm.ws_subscribersCount_Response) As Integer

        Dim txn As New crm.ws_subscribersCount_Request

        Dim credentials As New soap_credentials()
        soap_credentials_io.soap_configuration_read(credentials)

        Dim m_endpointUrl As String = Nothing
        Dim m_serviceModel_Binding As System.ServiceModel.HttpBindingBase = Nothing
        Select Case credentials.EnableSSL

            Case True

                m_serviceModel_Binding = New System.ServiceModel.BasicHttpsBinding()
                Dim x As Integer = credentials.WebsiteUrl.LastIndexOf("//") + 2
                m_endpointUrl = "https://" & credentials.WebsiteUrl.Substring(x, credentials.WebsiteUrl.Length - x)

            Case False

                m_serviceModel_Binding = New System.ServiceModel.BasicHttpBinding()
                Dim x As Integer = credentials.WebsiteUrl.LastIndexOf("//") + 2
                m_endpointUrl = "http://" & credentials.WebsiteUrl.Substring(x, credentials.WebsiteUrl.Length - x)

        End Select

        txn.Credentials_Key = credentials.Secure_UserName
        txn.Credentials_Password = credentials.Secure_Password

        Dim remoteAddress As New System.ServiceModel.EndpointAddress(m_endpointUrl)

        'End of Set Credentials and End Point
        '//////////////////////////////////////////////////////////////////////////////////////////
        'Start of Request and Response

        Try

            Using client As New crm.ws_smtpMessengerSoapClient(m_serviceModel_Binding, remoteAddress)

                Dim responseType As New crm.ws_subscribersCount_Response
                responseType = client.subscribers_count(txn)
                pResult = responseType

                If (pResult Is Nothing) Then

                    pResult = New crm.ws_subscribersCount_Response
                    pResult.response_Code = "E100"
                    pResult.response_Text = ""

                End If

            End Using            

        Catch ex As Exception            

            pResult = New crm.ws_subscribersCount_Response
            pResult.response_Code = "ESOAP"
            pResult.response_Text = ex.Message.ToString

        End Try

        'End of Request and Rssponse
        '//////////////////////////////////////////////////////////////////////////////////////////

    End Function

Maybe someone could help and fix the formatting, in the past it worked great, now I struggle with it.
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.

GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee20-Dec-16 21:17
professionalTridip Bhattacharjee20-Dec-16 21:17 
AnswerRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx21-Dec-16 9:49
professionaljkirkerx21-Dec-16 9:49 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee21-Dec-16 20:31
professionalTridip Bhattacharjee21-Dec-16 20:31 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx22-Dec-16 8:20
professionaljkirkerx22-Dec-16 8:20 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee22-Dec-16 21:28
professionalTridip Bhattacharjee22-Dec-16 21:28 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx23-Dec-16 7:02
professionaljkirkerx23-Dec-16 7:02 
QuestionASMX Web Service Soap Extension ProcessMessage function not calling Pin
Tridip Bhattacharjee19-Dec-16 2:09
professionalTridip Bhattacharjee19-Dec-16 2:09 
AnswerRe: ASMX Web Service Soap Extension ProcessMessage function not calling Pin
Tridip Bhattacharjee21-Dec-16 20:32
professionalTridip Bhattacharjee21-Dec-16 20:32 
Questionasp .net web development Pin
Sanju govind18-Dec-16 20:53
Sanju govind18-Dec-16 20:53 
AnswerRe: asp .net web development Pin
Peter Leow18-Dec-16 21:02
professionalPeter Leow18-Dec-16 21:02 
QuestionRe: asp .net web development Pin
ZurdoDev19-Dec-16 8:23
professionalZurdoDev19-Dec-16 8:23 
AnswerRe: asp .net web development Pin
koolprasad200320-Dec-16 22:43
professionalkoolprasad200320-Dec-16 22:43 
QuestionNeed help on passing id to next page on response.redirect Pin
Bootzilla3318-Dec-16 10:43
Bootzilla3318-Dec-16 10:43 
AnswerRe: Need help on passing id to next page on response.redirect Pin
F-ES Sitecore18-Dec-16 21:59
professionalF-ES Sitecore18-Dec-16 21:59 
QuestionData not updating on fields using UPDATE Statement Pin
Bootzilla3318-Dec-16 10:41
Bootzilla3318-Dec-16 10:41 
AnswerRe: Data not updating on fields using UPDATE Statement Pin
Richard Deeming19-Dec-16 2:33
mveRichard Deeming19-Dec-16 2:33 
GeneralRe: Data not updating on fields using UPDATE Statement Pin
Bootzilla3319-Dec-16 8:21
Bootzilla3319-Dec-16 8:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.