Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Asp.net and the HttpAPI
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Asp.net and the HttpAPI

 Post Reply Post Reply
Author
Romnus View Drop Down
Groupie
Groupie


Joined: 16 September 2009
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote Romnus Quote  Post ReplyReply Direct Link To This Post Topic: Asp.net and the HttpAPI
    Posted: 06 October 2009 at 4:25am
Ok, I have done alot of research on the xml Http object with the use of Javascript. Before I didn't know anything about it. But feel that I have gain a substantial understanding of it all. Anyhow,I am still a little bit confuse with the HttpAPI.asp. How does it relate to my asp.net membership?  Is the example given (e.g."HttpAPI.asp?action=GetUsers&Username=Adminsitrator&Password=letmein" ) looking for the information in a database? Which database? How will I gaurante that my user that created an account will have unmitigated access to the forums if I am not allowed to check to see if they are already in my database via my .aspx page with my code? The example below  shows an absolute url to a asp page that checks to see if the username already exist.  How will the HTTPAPI check to see if the user exist if it is not checking the original database with which the user already exist. If I sound confuse, I am. Enlighten me with your knowledge if you can.

Here are my hopes that this Web wiz forum can accomplish or else I wasted $129.00 plus tax and will be moving on to another forum software.

1. The user should be able to access the forums without having to create a new account.
2. I would like to display the username and profile image in the forums.
3. I also woud like to display thing such as, age, location and date join the site.

Is any of this posible with this forum?  Thank you.

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
function validateuserid(suserid) {

document.body.style.cursor='wait';

// Create an instance of the XML HTTP Request object
var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
	
// Prepare the XMLHTTP object for a HTTP POST to our validation ASP page
var sURL = "http://mysite/mypath/validateuser.asp?username=" + suserid
oXMLHTTP.open( "POST", sURL, false );

// Execute the request
oXMLHTTP.send();

if (oXMLHTTP.responseText == "exists") 
alert("Sorry - the User ID " + suserid + " already exists.");

document.body.style.cursor='auto';
}
</SCRIPT>
---------------------------
<%
Dim objConn, objRS, sUserID

'Capture the username that we need to lookup, making sure its prepared for 
'our forthcoming SQL query
sUserID = Replace(Trim(Request.QueryString("userid")),"'","")	

'Fire up ADO - ask the database whether or not the user idexists
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open CONNECTIONSTRING
sSQL = "select userid from usertable where userid = '" + sUserID + "'"
Set objRS = objConn.Execute(sSQL)
If Not objRS.EOF Then Response.Write "exists"   

'Clean up
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2009 at 9:56am
This is going to be quite hard to explain as it would seem you have the completly wrong end of the stick when it comes to working with HTTP XML API's.

All the things that you want to do are available, however you need to first understand how to use an API like this.

The API is like an interface between your own code and the forums own database and interacts directly with the forums database to complete which ever action you request from the API.

You would not use JavaScript to send the request to the API as JavaScript is client side and you would be exposing your login details to your client.  You need to using Server Side Code to send the request and then parse the returned XML result. With Classic ASP you would use the Microsoft HTTPXML object to POST a request to the API with ASP.NET you would look at using HttpWebRequest and HttpWebResponse classes in System.Net namespace.

For example if you wanted to add a new user to the forums database you would use the CreateNewMember action. You would use ASP.NET to send a HTTP POST request to the API that contains your admin login, the action (CreateNewMember), and the data you want written to the database for the new member. The API would then return an XML response which would tell you if the action was successful or failed.

In the same was you could get data on a member from the forums API by using the GetMemberByName. You would use ASP.NET to POST your request to the API with your admin login, the action (GetMemberByName), and the members name. You would then have an XML Response that would contain all the data on this member. You would parse this XML to get the parts you require. You can see the type of response below:-


<ApiResponse>
<ErrorCode>0</ErrorCode>
<ErrorDescription/>

<ResultData recordcount="1">

<Record>
<Username>administrator</Username>
<UserID>1</UserID>
<Group>Admin Group</Group>
<GroupID>1</GroupID>
<MemberCode>administratorD91B6897ZZ</MemberCode>
<EncryptedPassword>A85B3E67CFA695D711570FB9822C0CF82871903B</EncryptedPassword>
<Salt>72964E7</Salt>
<Active>True</Active>
<Suspended>False</Suspended>
<Joined>2007-01-01 00:00:00</Joined>
<LastVisit>2009-10-06 07:12:06</LastVisit>
<Email/>
<Name/>
<DOB/>
<Gender/>
<PostCount>13</PostCount>
<Newsletter>False</Newsletter>
</Record>
</ResultData>
</ApiResponse>

Back to Top
Romnus View Drop Down
Groupie
Groupie


Joined: 16 September 2009
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote Romnus Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2009 at 3:59pm
Thank you WebWiz-Bruce. Your explanation has unclouded my eyes, sort to speak. I hope I didn't come off as mean-spirited or angry in my first post. I am just ignorant about issue at hand. But, I am learning allot. Thanks again. 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.