SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Sojan80's Avatar
    Join Date
    May 2002
    Location
    Central WI, US
    Posts
    262
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error MEssage When Building Site

    I'm attempting to add photo albums to my first ASP.NET site. Basically what I've tried to do so far is take the one from the personal web page starter kit and adapt it to fit my site layout. Everything seems to work fine except one thing in the admin panel. I can create new galleries just fine, make them public or private, and the bulk upload and what not works fine.

    But when I am on the default albums page and I click the edit button to edit the names that appear with each image in a given album I get the following error:

    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0030: Cannot convert type 'System.IO.FileInfo' to 'FileInfo'

    Source Error:


    Line 21: {
    Line 22: DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/Upload"));
    Line 23: foreach (FileInfo f in d.GetFiles("*.jpg"))
    Line 24: {
    Line 25: byte[] buffer = new byte[f.OpenRead().Length];


    Source File: d:\Inetpub\wwwroot\someserver\mysite\admin\photogallery\Photos.aspx.cs Line: 23

    I've gone over the code I have versus what's in the starter kit and everything looks to be right. And I am not sure what to do to fix it. Anyone else got any ideas I could try?

    [update]
    Original code from codebehind file:
    using System;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data;
    using System.Data.OleDb;
    using System.IO;


    public partial class admin_photogallery_Photos : System.Web.UI.Page
    {

    protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
    if (((Byte[])e.Values["BytesOriginal"]).Length == 0) e.Cancel = true;
    }

    protected void Button1_Click(object sender, ImageClickEventArgs e)
    {
    DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/Upload"));
    foreach (FileInfo f in d.GetFiles("*.jpg"))
    {
    byte[] buffer = new byte[f.OpenRead().Length];
    f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
    PhotoManager.AddPhoto(Convert.ToInt32(Request.QueryString["AlbumID"]), f.Name, buffer);
    }
    GridView1.DataBind();
    }

    }
    [/update]
    Last edited by Sojan80; Sep 20, 2007 at 12:07. Reason: Posting original code from codebeind as it might help resolve this error

  2. #2
    SitePoint Addict Sojan80's Avatar
    Join Date
    May 2002
    Location
    Central WI, US
    Posts
    262
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, oddly enough the problem somehow resolved itself after a reboot....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •