passing parameters to

Apr 3, 2008 at 10:47 PM
Hi all,

I like to bind dynamicly to data. Some samples here were more then usefull. In the end I settle for (which works lovely):

<dataProvider type="XmlDataProvider" >
<option name="url" value="Data.ashx" />

Trouble is dat I like to pass querstrings to data.ashx, any idea how to do this? The next go will probably be something like session variables. But since the rest of the site is using querystring, that would be easier.


Apr 4, 2008 at 5:27 PM
Edited Apr 4, 2008 at 5:28 PM
I'm not totally happy, but I managed to pass throught the parameters I needed by use of cookies.

The next little trouble I had was caching of the data.ashx. That's normally a good thing. But because I'm requesting a different set of pictures everytime I needed to switch caching of on the client. For those looking for the same

the data.ashx (please ignore my pulling pictures from my backend)

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim objXMLWriter As XmlTextWriter
Dim blnEndAlbum As Boolean = True
Dim intCounter As Integer = 1

Dim idItem As String = HttpContext.Current.Request.Cookies("imageQuery")("idItem")
Dim idFoto As String = HttpContext.Current.Request.Cookies("imageQuery")("idFoto")

Dim fotos() As cms2008.CmsFile = cms2008.CmsFile.GetCmsFiles(idItem, "cmsFoto", cms2008.CmsFile.FileType.Image, 9999)

context.Response.Buffer = False
context.Response.ContentType = "text/xml"

Dim rd As Random = New Random()
context.Response.AddHeader("ETag", rd.Next(1111111, 9999999).ToString())
context.Response.AddHeader("Pragma", "no-cache")
context.Response.CacheControl = "no-cache"
context.Response.Expires = -1

objXMLWriter = New XmlTextWriter(context.Response.Output)

objXMLWriter.Formatting = Formatting.Indented
objXMLWriter.WriteAttributeString("transition", "CrossFadeTransition")

Dim eerste As Boolean = True

If Not IsNothing(fotos) Then
For Each foto As cms2008.CmsFile In fotos
If eerste Then
objXMLWriter.WriteAttributeString("title", "fotoAlbum: titel bericht ofzo")
objXMLWriter.WriteAttributeString("description", "omschrijving hierbij, teaser?")
objXMLWriter.WriteAttributeString("image", "/images/cmsFoto/" + foto.FileName)
eerste = False
End If

If File.Exists(HttpContext.Current.Server.MapPath("~/images/cmsFoto/" + foto.FileName)) Then

objXMLWriter.WriteAttributeString("title", foto.Name)
objXMLWriter.WriteAttributeString("description", foto.Description)
objXMLWriter.WriteAttributeString("image", "/images/cmsFoto/" + foto.FileName)
objXMLWriter.WriteAttributeString("thumbnail", "/images/cmsFoto/thumbs/" + foto.FileName)
End If

If Not eerste Then objXMLWriter.WriteEndElement()
End If

'Write the XML to file and close the myXmlTextWriter

End Sub