Question : System.Drawing.Bitmap problem going from 2.0 to 3.5

I have just updated my website from ASP.NET 2.0 to 3.5 (using Visual Studio) as I needed some of the 3.5-controls in the AjaxControlToolkit. However, this has given me a problem with the System.Drawing.Bitmap. In my code I have to rescale images according to their size-ratio (width/height). I do this with the enclosed code.

This works perfect in the 2.0-environment, but after upgrading to 3.5 I get the following error:
System.ArgumentException: Parameter is not valid.

The source-line is:
using (System.Drawing.Image img = new System.Drawing.Bitmap(Server.MapPath("~/" + img2.ImageUrl.ToString())))

Why?
Are there any changes from 2.0 to 3.5 that will not accept my Bitmap-constructor and cause this error?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
protected void imgSize(Image img2)
    {
        using (System.Drawing.Image img = new System.Drawing.Bitmap(Server.MapPath("~/" + img2.ImageUrl.ToString())))
        {
            double maxWidth = 100;
            double maxHeight = 100;
            double Width = Convert.ToDouble(img.Width);
            double Height = Convert.ToDouble(img.Height);
            if ((Height / maxHeight) > (Width / maxWidth))
            {
                Width = Width * (100.0 / Height);
                Height = 100;
            }
            else
            {
                Height = Height * (100.0 / Width);
                Width = 100;
            }
            img2.Height = Convert.ToInt32(Height);
            img2.Width = Convert.ToInt32(Width);
        }
    }

Answer : System.Drawing.Bitmap problem going from 2.0 to 3.5

If that's EXACTLY what you have, then you have a space in there that should be.

for /f "tokens=1*" %a in ('for /r %c in ^("C:\Devapps\Projects\code\"^) do wc -l *.clw') do @echo %a, %b >>c:\linecounts.csv

In testing this, I had:
for /f "tokens=1*" %a in ('for /r %c in ^(c:\temp\^) do wc -l *.txt') do @echo %a, %b
and it worked fine... hmmm... very odd... I do see your version is otherwise the same... where is wc located (I put it in a folder that's in my path).

Well, another possibility - as I did kind of throw a curve ball there (I switched the for command from a /f to a /r (/r walks a directory structure; /f processes with more of a list format.

No reason I can see why it wouldn't be working, but try this instead (going back to the method of my first offering):

for /f "tokens=1*" %b in ('for /f "tokens=*" %a in ^('dir /b /s /a-d  C:\Devapps\Projects\code\*.clw'^) do @wc -l "%a"') do @echo %b,%c>>c:\linecounts.csv
Random Solutions  
 
programming4us programming4us