Please Help - Handler.ashx RRS feed

  • Question

  • User-579715224 posted

     I have downloaded the Personal Web Site Starter Kit (Both C#  &  VB)

    Both Versions (C#  &  VB) experience errors in the  Handler.ashx  where PhotoSize is not defined.

    I am new to .Net and would very much appreciate some help in resolving this error.  The application will not run as the build experiences these errors and can not continue.   If I could get a running version - I am sure I could install an use the system.

    Please Help.




    Wednesday, January 7, 2009 3:02 PM

All replies

  • User-1705717250 posted

    Well the first question really is how are you running this?

    So you downloaded the kit, installed into vwd, created a new website using the vwd template and then you are using view in browser?

    Also do you have sql express installed on your workstation?

    Hope it helps

    Thursday, January 8, 2009 12:04 PM
  • User-579715224 posted

    I downloaded the E-Commerce, Club Kit, Beer House & Personal Web Site 

    I opened the site(s) with VWD Express and the E-Commerce, Club Kit and Beer House run fine from F5  -but-  the Personal Web Site gets errors...

    Yes sql express is installed and runs fine with the other Starter Kits - - - I am very new to .Net

           but it appears to me that there is a definition missing for the element  "PhotoSize" in the Handler.ashx  -or-  somewhere

    there are 8 errors referring to  "PhotoSize"  in the Handler.ashx module like:

    Error    1    The type or namespace name 'PhotoSize' could not be found (are you missing a using directive or an assembly reference?)    C:\Inetpub\wwwroot\PersonalWebSite C#\Handler.ashx    21    3    C:\...\PersonalWebSite C#\

    Handler.ashx starts out like:

    <%@ WebHandler Language="C#" Class="Handler" %>

    using System;
    using System.IO;
    using System.Web;

    public class Handler : IHttpHandler {

        public bool IsReusable {
            get {
                return true;
        public void ProcessRequest (HttpContext context) {
            // Set up the response settings
            context.Response.ContentType = "image/jpeg";
            context.Response.BufferOutput = false;
            // Setup the Size Parameter
            PhotoSize size;
            switch (context.Request.QueryString["Size"]) {
                case "S":
                    size = PhotoSize.Small;
                case "M":
                    size = PhotoSize.Medium;
                case "L":
                    size = PhotoSize.Large;
                    size = PhotoSize.Original;

    IF I knew WHERE and HOW to (define / declare) the definition for  "PhotoSise"  I think the application would run  -but-

         like I said - I am very new and I don't know 'where' or 'how' to define it

         like in the   Class    "Photo"     public int PhotoID { get { return _id; } }    should I add another line for

                                                      public int PhotoSize { get { return _id; } }      -see-    I am very new

    It looks like the definition for  "PhotoSize"  is missing....



    Thursday, January 8, 2009 5:35 PM
  • User-1023877931 posted

    I am having the same error, have you got an answer.  can't someone help 

    Friday, January 9, 2009 4:52 PM
  • User-1216623568 posted

     Do you have the photosize class file in the App_Code folder? It should contain the following for the vb version

    Public Enum PhotoSize
        Small = 1
        Medium = 2
        Large = 3
        Original = 4
    End Enum

    Saturday, January 31, 2009 10:41 PM
  • User-579715224 posted

    'ALL' of the references in the vb app are as follows:

    Find all "PhotoSize", Subfolders, Find Results 1, "Entire Solution"
      C:\Inetpub\wwwroot\PersonalWebSite VB\Handler.ashx(18):        Dim size As PhotoSize = PhotoSize.Original
      C:\Inetpub\wwwroot\PersonalWebSite VB\Handler.ashx(21):                size = PhotoSize.Small
      C:\Inetpub\wwwroot\PersonalWebSite VB\Handler.ashx(23):                size = PhotoSize.Medium
      C:\Inetpub\wwwroot\PersonalWebSite VB\Handler.ashx(25):                size = PhotoSize.Large
      C:\Inetpub\wwwroot\PersonalWebSite VB\Handler.ashx(27):                size = PhotoSize.Original
      C:\Inetpub\wwwroot\PersonalWebSite VB\PersonalWebSite.vstemplate(30):                <ProjectItem>PhotoSize.vb</ProjectItem>
      C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoManager.vb(16):    Public Overloads Shared Function GetPhoto(ByVal photoid As Integer, ByVal size As PhotoSize) As Stream
      C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoManager.vb(35):    Public Overloads Shared Function GetPhoto(ByVal size As PhotoSize) As Stream
      C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoManager.vb(37):        If (size = PhotoSize.Small) Then
      C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoManager.vb(40):            If (size = PhotoSize.Medium) Then
      C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoManager.vb(43):                If (size = PhotoSize.Large) Then
      C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoManager.vb(53):    Public Shared Function GetFirstPhoto(ByVal albumid As Integer, ByVal size As PhotoSize) As Stream
      C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoSize.vb(1):Public Enum PhotoSize
      Matching lines: 13    Matching files: 4    Total files searched: 44

     -but- when I try to 'run' it from VWD Express (Ctrl+F5) the PhotoManager.vb and the Handler.ashx get errors like:

    Error    1    Type 'PhotoSize' is not defined.    C:\Inetpub\wwwroot\PersonalWebSite VB\PhotoManager.vb    16    87    C:\...\PersonalWebSite VB\


    Error    17    Name 'PhotoSize' is not declared.    C:\Inetpub\wwwroot\PersonalWebSite VB\Handler.ashx    21    12    C:\...\PersonalWebSite VB\

    does anyone have an idea to whats up ?




    Tuesday, February 17, 2009 4:19 PM
  • User-1216623568 posted


    Have you modified the files or are you getting the error straight from the downloaded template?

    Are you getting the error on a specific page or is the site erroring before it completely loads?

    Do you get any error lines in VWD code view?

    I have hung the vb files at http://www.designsbymarquize.com/downloads/default.aspx  if you want to download and try.

    Tuesday, February 17, 2009 10:28 PM
  • User-579715224 posted

    The files are straight from the download with no modifications.

    The errors show up when I try to run from VWD Express with a Ctrl+F5 

    The errors only show up when I try to (execute / build) the application.

    I originally downloaded a .zip file from the Starter Kit web site.  I don't know what to do with  .rar  files.  I am running with Windows XP Pro.....





    Wednesday, February 18, 2009 11:39 AM
  • User-1216623568 posted

    Does the site launch if you right click on the default.aspx in the solution explorer and click "view in browser"? Also, a .rar is another type of file compression used by a software name winrar. I have uploaded a .zip also. http://www.designsbymarquize.com/downloads/default.aspx . If you want to, you can send me an email and will try and work this issue with you. webmaster@designsbymarquize.com  

    Wednesday, February 18, 2009 1:12 PM