This project is read-only.

Another "Database" Question

Jan 17, 2009 at 4:17 AM
I see there have been a couple of posts on the Database portion, but they are not exactly the same as what I am looking for.  It seems as though people want to actually store the images in the database, and this is not what I am after.  I want to stores the files in a directory and then store the file path in the database as well as the description, title, etc.  Is there a nice clean solution on how to do this?  I don't need an image handler or anything like that...

Thanks in advance.
Jan 17, 2009 at 10:40 PM
Well I am making progress, but can't seem to figure out why the Slide.Show app won't work when using the QueryString in my ashx.

SlideShow.ashx
<%@ WebHandler Language="VB" Class="SlideShow" %>
Imports System
Imports System.Web
Imports System.Xml
Public Class SlideShow : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim AlbumID As Integer = CInt(context.Request.QueryString("PID"))
context.Response.Buffer = False
context.Response.Clear()
Using writer As New XmlTextWriter(context.Response.Output)
Dim SlideShowDC As New SlideShowDataContext
Dim r = SlideShowDC.GetSlideShowImages(AlbumID).ToList
writer.Formatting = Formatting.Indented
writer.WriteStartDocument()
writer.WriteStartElement("data")
writer.WriteAttributeString("transition", "CrossFadeTransition")
writer.WriteStartElement("album")
For Each record As Object In r
writer.WriteStartElement("slide")
writer.WriteAttributeString("title", record.Title)
writer.WriteAttributeString("source", record.Path)
writer.WriteEndElement()
Next
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Flush()
End Using
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class


Then I am using this in my Default.aspx
<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="100%" height="100%">
<param name="background" value="black" />
<param name="source" value="Vertigo.SlideShow.xap" />
<param name="initParams" value="ConfigurationProvider=LightTheme,DataProvider=XmlDataProvider;Path=slideshow.ashx?PID=1"/>
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /></a>
</object>

Am I Close?  Is there a reason why my ashx won't work when using the querystring?
Jan 18, 2009 at 12:06 AM
It's all good, I posted my results and SOLUTION on my blog
http://www.dotnetblogger.com/post/2009/01/17/Vertigo-SlideShow2-Database-to-XML.aspx