?
Solved

User Authentication and Read XML from URL in ASP.NET

Posted on 2009-05-06
1
Medium Priority
?
315 Views
Last Modified: 2012-05-06
User Authentication*:

In API I need to have authentificate by "user name" and your "password".
First, I have to request an api-signature by requesting "http://www.xyz.com/api/get_api_signature.php".
Next, I have to build an auth_token. auth_token=md5(md5(password)+api_signature).
At last I have to send your "user name" (auth_user_name=<user_name>), the requested "api-signature" (api_signature=<api_signature>) and  auth_token (auth_token=<auth_token>) with normal api-request.
The Api-Signature is valid for 1 minute.

Example :
1. Request api-signature: GET -> http://www.xyz.com/api/get_api_signature.php
2. Answer of the request: "8b55eac3b2291b201fc59cd8b76410ab"
3. Build auth_token:
    md5(md5("testpassword")+"8b55eac3b2291b201fc59cd8b76410ab") =
    md5("e16b2ab8d12314bf4efbd6203906ea6c"+"8b55eac3b2291b201fc59cd8b76410ab") =
    "c8b066236c8cbcc280921b93f24e281a"
4. Parameters:
    auth_user_name="testuser",
    api_signature="8b55eac3b2291b201fc59cd8b76410ab",
    auth_token="c8b066236c8cbcc280921b93f24e281a"
5. Request: http://www.xyz.com/api/get_photos_xml.php?category=submitted&auth_user_name=testuser&api_signature=8b55eac3b2291b201fc59cd8b76410ab&auth_token=c8b066236c8cbcc280921b93f24e281a&user_name=testuser&size=large&locr=true

Now how I execute these steps in ASP.net 2.
Result of URL need to take it in Data Set to display in Grid.

Thanks,
Regards,
0
Comment
Question by:FairGuy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
FairGuy earned 0 total points
ID: 24343985
Hi All,

Now I solve this Problem by My Self, I worte class library name ClassLibrary,vb for MD5 and URLGet value.

Imports System.Security.Cryptography
Imports IST
Imports System.IO
Imports System.Net
Imports System.Text
Imports Microsoft.VisualBasic
Public Class ClassLibrary
    Public NotInheritable Class PhpCompatible
        Public Shared Function Md5Hash(ByVal pass As String) As String
            Dim md5 As MD5 = MD5CryptoServiceProvider.Create()
            Dim dataMd5 As Byte() = md5.ComputeHash(Encoding.[Default].GetBytes(pass))
            Dim sb As New StringBuilder()
            For i As Integer = 0 To dataMd5.Length - 1
                sb.AppendFormat("{0:x2}", dataMd5(i))
            Next
            Return sb.ToString()
        End Function

        Public Shared Function HttpGet(ByVal URI As String) As String
            Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(URI)
            'req.Proxy = New System.Net.WebProxy(ProxyString, True)
            'true means no proxy
            Dim resp As System.Net.WebResponse = req.GetResponse()
            Dim sr As New System.IO.StreamReader(resp.GetResponseStream())
            Return sr.ReadToEnd().Trim()
        End Function
    End Class
End Class

So, I call class in ASPX files and job done.

I make URL for last point and call for DBGrid using XML as below.

       Dim myDataSet As New DataSet
        myDataSet.ReadXml(UrlString1)
        Dim dv As DataView = New DataView(myDataSet.Tables(2))

        Datagrid1.DataSource = dv
        Datagrid1.DataBind()

Bye.

So Administrator please close this Issue.

Regards,
Nayeem.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question