Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 asp.net vb help, help

views
     
TSzonlee
post Jan 21 2006, 05:54 PM, updated 20y ago

On my way
****
Senior Member
506 posts

Joined: Oct 2004
help i have problem
code here
the problem i on path1

when i set path1 = server.mappath(".") + "\"+ xfile.name the compiler show me System.ArgumentException: Parameter is not valid.

when i set path1 ="C:\Documents and Settings\IT2\Desktop\web\resize\IMG_0989.JPG" it no problem

i tried response.write (server.mappath(".") + "\"+ xfile.name) and response.write ("C:\Documents and Settings\IT2\Desktop\web\resize\IMG_0989.JPG")
and both value is totaly same


CODE

<%@ Page Language="VB"   debug="true"%>
<%@ Import Namespace="System.IO" %>
<%@ import namespace="System.Diagnostics" %>
<%@ Import Namespace="Microsoft.Win32" %>
<%@ Import Namespace="System.Drawing" %>
<script language="VB" runat="server">
sub page_load()
dim url as string = server.MapPath(".") & "\"

dim mydir as new DirectoryInfo(url)
dim hupo as string
dim xfile as fileinfo


 For each xfile in mydir.getfiles()
  Dim pic1 as bitmap

 'response.write ( "<br>")
 Dim path1 as String
 path1 = server.mappath(".") + "\"+ xfile.name
 'path1 ="C:\Documents and Settings\IT2\Desktop\web\resize\IMG_0989.JPG"
 'response.write ( server.mappath(".") + "\"+ xfile.name +"<br>")
 'Dim path1 as String ="IMG_0990.JPG"
 'response.write (path1)
' pic1 = new bitmap(100,100)

pic1 = new bitmap(path1)
 'response.write("created")

 pic1.save(response.outputstream,System.Drawing.Imaging.ImageFormat.jpeg)
'  pic1.save("c:\temp\" & xfile.name &".jpg",System.Drawing.Imaging.ImageFormat.jpeg)
 
 
 pic1.Dispose()

 Next

end sub
</script>



This post has been edited by zonlee: Jan 21 2006, 05:58 PM
alvinz_c
post Jan 21 2006, 08:57 PM

Casual
***
Junior Member
407 posts

Joined: Oct 2004
Hi hi....

I suspect that the error occurs due to trying to open the non-image files at this line

pic1 = new bitmap(path1)

since you are getting all the files from the app directory.


Hope this helps...

TSzonlee
post Jan 21 2006, 09:48 PM

On my way
****
Senior Member
506 posts

Joined: Oct 2004
QUOTE(alvinz_c @ Jan 21 2006, 09:57 PM)
Hi hi....

I suspect that the error occurs due to trying to open the non-image files at this line

pic1 = new bitmap(path1)

since you are getting all the files from the app directory.
Hope this helps...
*
aiya

i am too stupic

thanks dark vader

monday try again



 

Change to:
| Lo-Fi Version
0.0152sec    0.35    5 queries    GZIP Disabled
Time is now: 23rd December 2025 - 04:32 AM