473,383 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

AJAX and Virtual VB XML file

I am writing an application in VB.net, visual studio 2005 and I want
to create a XML file to pass off to a HTTPRequest in javascript. I
have tried to pass it an xmldocument with out saving it, but the
HTTPRequest does not seem to recognize it as an XML file. Any
Suggestions?

Imports System
Imports System.Web
Imports System.Xml
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Administration
Imports Microsoft.SharePoint.WebControls
Imports Microsoft.SharePoint.Utilities
Imports Microsoft.SharePoint.WebPartPages

Public Class Handler : Implements IHttpHandler
Dim myspweb As SPWeb
Dim myspsite As SPSite

Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest

GetSharePointContext()

AddUserToGroup("258", "728")
GetUserGroups("258")

context.Response.ContentType = "application/xml"
context.Response.WriteFile("C:\xmlfile.xml")

End Sub

Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return False
End Get
End Property

Private Sub GetSharePointContext()
'If mySPWeb Is Nothing Then

mySPSite = New
SPSite(ConfigurationManager.AppSettings("SPServerU RL"))

mySPWeb = mySPSite.OpenWeb("/")
Dim users As SPUserCollection = mySPWeb.AllUsers

'End If
End Sub

Public Sub GetUserGroups(ByVal Userid)
GetSharePointContext()

Dim settings As New XmlWriterSettings()
settings.Indent = True
settings.NewLineOnAttributes = True

Using writer As XmlWriter = XmlWriter.Create("C:\xmlfile.xml",
settings)
writer.WriteStartDocument()
writer.WriteStartElement("root")
For Each MyGroup As SPGroup In mySPWeb.SiteGroups

Try
If Not MyGroup.Users.GetByID(Userid) Is Nothing
Then

writer.WriteStartElement("MemberOfGroup")
writer.WriteString(MyGroup.Name)
writer.WriteStartElement("MemberOfGroupID")
writer.WriteString(MyGroup.ID.ToString)
writer.WriteEndElement()
writer.WriteEndElement()
End If
Catch ex As Exception
writer.WriteStartElement("NonMemberOfGroup")
writer.WriteString(MyGroup.Name)
writer.WriteStartElement("NonMemberOfGroupID")
writer.WriteString(MyGroup.ID.ToString)
writer.WriteEndElement()
writer.WriteEndElement()
End Try

Next

writer.WriteEndElement()
writer.WriteEndDocument()
End Using
End Sub

Javascript
----------------------------------------------------------------------------------------------------------------

function xmlget(arg1,arg2,arg3,arg4,menu)
{

var xmlHttpObj = null;
if(window.XMLHttpRequest)
{
xmlHttpObj = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
return
}
xmlHttpObj.onreadystatechange = function()
{
if (xmlHttpObj.readyState == 4)
{
if (xmlHttpObj.status == 200)
{
if (arg1=='GroupAddUserToGroup')
{

DisplayGroupMembers(xmlHttpObj.responseXML)
}
if (arg1=='GroupRemoveUserFromGroup')
{

DisplayGroupMembers(xmlHttpObj.responseXML)
}

}
}
}

var loginfilesdata ="AdminTry3.ashx?arg1=" + arg1 +
"&arg2=" + arg2 + "&arg3=" + arg3 + "&arg4=" + arg4

xmlHttpObj.open("GET",loginfilesdata, true);

xmlHttpObj.send('');
}

Jun 19 '07 #1
0 1089

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alok yadav | last post by:
I have an open IP and on that IP our main application is hosted. it uses ajax. in web.config file i have register ajax handlers. there are also other sites or project on that IP. now my problem is...
1
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
2
by: Nathan Sokalski | last post by:
I have tried downloading and installing the ASP.NET AJAX Documentation from http://ajax.asp.net/documentation/default.aspx?tabid=47 but it requires me to do the following: 1. Install SQL Server...
5
by: toffee | last post by:
Hi, I need some pointers as I have no idea how to get started. I have a large table which pulls data from a mysql db. Because of the large number of records, it clugs up lot of memory and the...
4
by: Mike P2 | last post by:
Hi. To make page downloading quicker, I added GZipStream into the Response filter. My (shortened VB) code snippet from Global.asax looks like this: ............................................ ...
6
by: Bart Van der Donck | last post by:
Hello, I'm presenting my new library 'AJAX Cross Domain' - a javascript extension that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/ Any comments or...
2
by: =?Utf-8?B?Q2VzYXI=?= | last post by:
I have the ASP.NET 2.0 AJAX Extensions 1.0 installed (v1.0.61025). As to the web.config file, I'm using the one created using the ASP.NET AJAX-Enabled website ... This error is due to that I'm...
2
by: Liz | last post by:
I have both VS2005 and VS2008 installed and now find I need to work on some code using AJAX extensions/toolkit ... and I'm really a bit lost on what it is I need to install and hopefully have it...
3
by: sdja | last post by:
Hi.... I am developing a project using AJAX. It is something called as a virtual whiteboard. Virtual whiteboard is an application in which objects or text which are dragged and dropped on the...
1
by: shaunwo | last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.