Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Wednesday, March 28, 2012

System.IO.IOException

Hi all,

Yesterday we upgraded our server to the 1.1 Framework. (from 1.0)
Our project was also converted in Visual Studio to 1.1

Since we have uploaded the project, we are getting an error with one of our
pages which is trying to read a list of files from a network share and
populate a dropdownlist.

The error is:

System.IO.IOException: The specified network name is no longer available.

OR

System.IO.IOException: The specified network password is not correct.

The code is:

Dim fileEntries As String() = Directory.GetFiles(targetDirectory)

where targetdirectory is "\\192.168.1.1\data\General\Documents\"

If we try to view the page on our own machines ie http://localhost the page
works fine!!

So is there any fixes/ideas why this is happening!!

Thanks!How would you get TWO different error messages from the same code?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

"Krissy" <krissi___@.hotmail.com> wrote in message
news:3f27704b@.quokka.wn.com.au...
> Hi all,
> Yesterday we upgraded our server to the 1.1 Framework. (from 1.0)
> Our project was also converted in Visual Studio to 1.1
> Since we have uploaded the project, we are getting an error with one of
our
> pages which is trying to read a list of files from a network share and
> populate a dropdownlist.
> The error is:
> System.IO.IOException: The specified network name is no longer available.
> OR
> System.IO.IOException: The specified network password is not correct.
>
> The code is:
> Dim fileEntries As String() = Directory.GetFiles(targetDirectory)
> where targetdirectory is "\\192.168.1.1\data\General\Documents\"
>
> If we try to view the page on our own machines ie http://localhost the
page
> works fine!!
> So is there any fixes/ideas why this is happening!!
> Thanks!
"Kevin Spencer" <kevin@.takempis.com> wrote in message
news:ONRU7dpVDHA.2316@.TK2MSFTNGP09.phx.gbl...
> How would you get TWO different error messages from the same code?
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Complex things are made up of
> lots of simple things.
> "Krissy" <krissi___@.hotmail.com> wrote in message
> news:3f27704b@.quokka.wn.com.au...
> > Hi all,
> > Yesterday we upgraded our server to the 1.1 Framework. (from 1.0)
> > Our project was also converted in Visual Studio to 1.1
> > Since we have uploaded the project, we are getting an error with one of
> our
> > pages which is trying to read a list of files from a network share and
> > populate a dropdownlist.
> > The error is:
> > System.IO.IOException: The specified network name is no longer
available.
> > OR
> > System.IO.IOException: The specified network password is not correct.
> > The code is:
> > Dim fileEntries As String() = Directory.GetFiles(targetDirectory)
> > where targetdirectory is "\\192.168.1.1\data\General\Documents\"
> > If we try to view the page on our own machines ie http://localhost the
> page
> > works fine!!
> > So is there any fixes/ideas why this is happening!!
> > Thanks!

If I knew that then I wouldn't have the problem ;)

Monday, March 26, 2012

System.Net is not available in VS2005 Web project

I'm trying to access the System.Net.Mail namespace in an ASP.NET application (not website) and it's not available. Any ideas why not?

It is available in a different web site project, but not in an application.

Thanks,

Kahanu

make sure that a reference to System.dll assembly is exists in your application.

Saturday, March 24, 2012

System.Net.Webexecption on WebRequest.GetResponse

Hi Everybody,
after a while, ive had to maintain a ASP.NET/C# project, where
during processing of an request, the same (local!) webserver is
requested again for the response of a corresponding aspx-page.
Something like this:
...
string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
WebRequest req = WebRequest.Create( uri );
req.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();
Stream st = req.GetResponseStream;
...
This worked fine on my machine a few month ago, as well as on my
collegues machine and alos at the customer.
On all 3 machines, the local IIS instance is responsible to process
the aspx-Request (two XP-SP2, one W2k-Server).
Acutally, when i perform this again, ill get a
System.Net.Webexecption
on the execution of "req.GetResponse()" with following error-stack
System.Net.HttpWebRequest.CheckFinalStatus()
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
System.Net.HttpWebRequest.CheckFinalStatus()
myModule.myMethod()
etc. ...
This error appears also, when i replace the uri above f.e. with
'http://www.google.com'.
Even when i run a downloaded, ready-to-use C#-sample (EXE, not
ASP.NET!),
ill get this error.
On my collegues machine, the same things still works fine, even on the
customers
server, but im not able to test/debug this one on my machine anymore.
I dont know, what could be the reason for it.
My XPs configuration seems very identical to my collegues one.
Also my XP Servicepacks, Patches and .NET-Version look identical to
my
collegue ones.
But there must be a difference!
Does anyone has any idea, that maybe can keep me away from a complete
reinstallation of my machine?
Thanks in advance,
ThomasThis exception is also thrown if the statuscode is 404 for example. Have a
look at this:
<http://msdn.microsoft.com/library/d...o
pic.asp>
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/
"Thomas Geisel" <tgeisel@.symax.de> wrote in message
news:b455c2e.0501180203.cba6e16@.posting.google.com...
> Hi Everybody,
> after a while, ive had to maintain a ASP.NET/C# project, where
> during processing of an request, the same (local!) webserver is
> requested again for the response of a corresponding aspx-page.
> Something like this:
> ...
> string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
> WebRequest req = WebRequest.Create( uri );
> req.Credentials = CredentialCache.DefaultCredentials;
> WebResponse resp = req.GetResponse();
> Stream st = req.GetResponseStream;
> ...
> This worked fine on my machine a few month ago, as well as on my
> collegues machine and alos at the customer.
> On all 3 machines, the local IIS instance is responsible to process
> the aspx-Request (two XP-SP2, one W2k-Server).
> Acutally, when i perform this again, ill get a
> System.Net.Webexecption
> on the execution of "req.GetResponse()" with following error-stack
> System.Net.HttpWebRequest.CheckFinalStatus()
> System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
> System.Net.HttpWebRequest.CheckFinalStatus()
> myModule.myMethod()
> etc. ...
> This error appears also, when i replace the uri above f.e. with
> 'http://www.google.com'.
> Even when i run a downloaded, ready-to-use C#-sample (EXE, not
> ASP.NET!),
> ill get this error.
> On my collegues machine, the same things still works fine, even on the
> customers
> server, but im not able to test/debug this one on my machine anymore.
> I dont know, what could be the reason for it.
> My XPs configuration seems very identical to my collegues one.
> Also my XP Servicepacks, Patches and .NET-Version look identical to
> my
> collegue ones.
> But there must be a difference!
> Does anyone has any idea, that maybe can keep me away from a complete
> reinstallation of my machine?
> Thanks in advance,
> Thomas

System.Net.Webexecption on WebRequest.GetResponse

Hi Everybody,

after a while, ive had to maintain a ASP.NET/C# project, where
during processing of an request, the same (local!) webserver is
requested again for the response of a corresponding aspx-page.

Something like this:

...
string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
WebRequest req = WebRequest.Create( uri );
req.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();
Stream st = req.GetResponseStream;
...

This worked fine on my machine a few month ago, as well as on my
collegues machine and alos at the customer.
On all 3 machines, the local IIS instance is responsible to process
the aspx-Request (two XP-SP2, one W2k-Server).

Acutally, when i perform this again, ill get a
System.Net.Webexecption
on the execution of "req.GetResponse()" with following error-stack

System.Net.HttpWebRequest.CheckFinalStatus()
System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult)
System.Net.HttpWebRequest.CheckFinalStatus()
myModule.myMethod()
etc. ...

This error appears also, when i replace the uri above f.e. with
'http://www.google.com'.
Even when i run a downloaded, ready-to-use C#-sample (EXE, not
ASP.NET!),
ill get this error.

On my collegues machine, the same things still works fine, even on the
customers
server, but im not able to test/debug this one on my machine anymore.

I dont know, what could be the reason for it.
My XPs configuration seems very identical to my collegues one.
Also my XP Servicepacks, Patches and .NET-Version look identical to
my
collegue ones.
But there must be a difference!

Does anyone has any idea, that maybe can keep me away from a complete
reinstallation of my machine?

Thanks in advance,

ThomasThis exception is also thrown if the statuscode is 404 for example. Have a
look at this:

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetwebrequestclassendgetresponsetopic.a sp
--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/

"Thomas Geisel" <tgeisel@.symax.de> wrote in message
news:b455c2e.0501180203.cba6e16@.posting.google.com ...
> Hi Everybody,
> after a while, ive had to maintain a ASP.NET/C# project, where
> during processing of an request, the same (local!) webserver is
> requested again for the response of a corresponding aspx-page.
> Something like this:
> ...
> string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
> WebRequest req = WebRequest.Create( uri );
> req.Credentials = CredentialCache.DefaultCredentials;
> WebResponse resp = req.GetResponse();
> Stream st = req.GetResponseStream;
> ...
> This worked fine on my machine a few month ago, as well as on my
> collegues machine and alos at the customer.
> On all 3 machines, the local IIS instance is responsible to process
> the aspx-Request (two XP-SP2, one W2k-Server).
> Acutally, when i perform this again, ill get a
> System.Net.Webexecption
> on the execution of "req.GetResponse()" with following error-stack
> System.Net.HttpWebRequest.CheckFinalStatus()
> System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult)
> System.Net.HttpWebRequest.CheckFinalStatus()
> myModule.myMethod()
> etc. ...
> This error appears also, when i replace the uri above f.e. with
> 'http://www.google.com'.
> Even when i run a downloaded, ready-to-use C#-sample (EXE, not
> ASP.NET!),
> ill get this error.
> On my collegues machine, the same things still works fine, even on the
> customers
> server, but im not able to test/debug this one on my machine anymore.
> I dont know, what could be the reason for it.
> My XPs configuration seems very identical to my collegues one.
> Also my XP Servicepacks, Patches and .NET-Version look identical to
> my
> collegue ones.
> But there must be a difference!
> Does anyone has any idea, that maybe can keep me away from a complete
> reinstallation of my machine?
> Thanks in advance,
> Thomas

Thursday, March 22, 2012

System.OutOfMemory Exception urgent Help pls

Hi Guys,

I have a real serious problem that stoped me doing any progress in my project.

in one of my webpages I have a wizard of more then 13 pages and in every page some Ajax controls, textboxes, dropdownlists, about 4 panels, where every page in my wizard have almost the same controls;

so all what I had to do is copy the controls from a wizard page then paste it to next one and just change the controls names and it was going all fine till the page 8 in my wizard where pasting this set of controls is now giving me this error "System.OutOfMemory Exception" and this is happening at design time, and even just browsing between the wizard pages at design time is giving me the same error.

I thought that the wizard plus these controls are consuming too much memory so I changed my design and deleted the wizard and used MultiView instead but still the same problem.

So help me pls, or how can I increase the memory space used by Visual Studio knowing that my pc's RAM is 2G and still have 30G free disk space!!!!?

Thanks
Regards,
M.RochdiYou say that the code is almost the same in all pages, lets see the code and
what the differences are.
When you used the MultiView what page did you get the error on?
You may need to add code bit by bit find the problem.
What do the pages do, is it possible that your machine is running out of
memory without an error?
"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:EBE6EFED-83EB-4648-930E-A33A66C3F9CC@.microsoft.com...
> Hi Guys,
> I have a real serious problem that stoped me doing any progress in my
> project.
> in one of my webpages I have a wizard of more then 13 pages and in every
> page some Ajax controls, textboxes, dropdownlists, about 4 panels, where
> every page in my wizard have almost the same controls; so all what I had
> to
> do is copy the controls from a wizard page then paste it to next one and
> just
> change the controls names and it was going all fine till the page 8 in my
> wizard where pasting this set of controls is now giving me this error
> "System.OutOfMemory Exception" and this is happening at design time, and
> even
> just browsing between the wizard pages at design time is giving me the
> same
> error. I thought that the wizard plus these controls are consuming too
> much
> memory so I changed my design and deleted the wizard and used MultiView
> instead but still the same problem. So help me pls, or how can I increase
> the
> memory space used by Visual Studio knowing that my pc's RAM is 2G and
> still
> have 30G free disk space!!!!?
>
> Thanks
>
> --
> Regards,
> M.Rochdi
You say that the code is almost the same in all pages, lets see the code and
what the differences are.
I said that the controls are almost the same in every wizard page witch
means the Design code would be almost the same, but its really too long to
cut and past it in my post.
When you used the MultiView what page did you get the error on?
with MultiView there was only one page. I deleted the wizard witch means all
its pages and I used a MultiView instead with 13 Views in my webpage and whe
n
trying to add more controls to View 8 or 9 that error will start to come up
in the add control it self. but anyway, when having the wizard just browsing
backward and forward between the wizard pages at design time will give the
same error.
What do the pages do?
the controls in the page will change to a Gray box will the above error.
is it possible that your machine is running out of
memory without an error?
Well I do have 2G RAM and when I checked the Performance of my CPU it was
only from 1% to 40% but I don't know how much memory is conserved to Visual
Studio to work and I've heard that you can increase the memory that VS can
work on but I don't know How?
Regards,
M.Rochdi
"ThatsIT.net.au" wrote:

> You say that the code is almost the same in all pages, lets see the code a
nd
> what the differences are.
> When you used the MultiView what page did you get the error on?
> You may need to add code bit by bit find the problem.
> What do the pages do, is it possible that your machine is running out of
> memory without an error?
>
> "Mike" <Mike@.discussions.microsoft.com> wrote in message
> news:EBE6EFED-83EB-4648-930E-A33A66C3F9CC@.microsoft.com...
>

System.OutOfMemoryException: Out of memory.

Hello all

I have a ASPX file called scaleimage.aspx that scales my images down
to a given width. This page is used very much in web project I am
working on.

But due to the large size of the images I randomly get [X] images
(error) in Internet Explorer. When I open one individual image at that
point I read this exception:

[OutOfMemoryException: Out of memory.]
System.Drawing.Bitmap..ctor(String filename) +197
tekno.scaleimage.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Any suggestions are more than welcome. I hope you can help me.
Thank you in advance.

Regards,

Freek Versteijn

See here my code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Request("path") Is Nothing Or Request("width") Is Nothing
Then
Return
End If

Dim img As Image = New
Bitmap(Server.MapPath(Server.UrlDecode(Request("path"))))
img = resizeImage(img, Request("width"), 0)

Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.ContentType = "Image/JPEG"

img.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)
Response.End()

'Dispose the image object immediately to limit memory use in
case highres/large images are used
img.Dispose()
End Sub

Public Function ResizeImage(ByRef image As Image, ByVal maxWidth
As Integer, ByVal maxHeight As Integer)
Dim imgHeight, imgWidth As Double

Dim bm As Bitmap = New Bitmap(image)

imgHeight = bm.Height
imgWidth = bm.Width

If (maxWidth > 0 And imgWidth > maxWidth) Or (maxHeight > 0
And imgHeight > maxHeight) Then
'Determine what dimension is off by more
Dim deltaWidth As Double = imgWidth - maxWidth
Dim deltaHeight As Double = imgHeight - maxHeight
Dim scaleFactor As Double

'If (deltaHeight > deltaWidth) Then
'Scale by the height
'scaleFactor = maxHeight / imgHeight
'Else
' 'Scale by the Width
scaleFactor = maxWidth / imgWidth
'End If

imgWidth *= scaleFactor
imgHeight *= scaleFactor
End If

Dim w As Integer = Convert.ToInt32(imgWidth)
Dim h As Integer = Convert.ToInt32(imgHeight)
Dim inp As IntPtr = New IntPtr
Dim bmp As System.Drawing.Image = bm.GetThumbnailImage(w, h,
Nothing, inp)

Return bmp
End FunctionHi, Versteijn,

Did you try using the DrawImage method on the Graphics class instead? You
will have to change the following lines:

> Dim inp As IntPtr = New IntPtr
> Dim bmp As System.Drawing.Image = bm.GetThumbnailImage(w, h, Nothing, inp)

to:

Dim bmp As New Bitmap(w, h)
Graphics.FromImage(bmp).DrawImage(bm, w, h)

Hope this helps
Martin
Sorry, it should be another overload:

Graphics.FromImage(bmp).DrawImage(bm, 0, 0, w, h)

It is so easy with the IntelliSence...

Greetings
Martin
"Martin Dechev" <detcheff_@.hotmail.com> wrote in message news:<#uSXmc3$DHA.2660@.TK2MSFTNGP10.phx.gbl>...
> Sorry, it should be another overload:
> Graphics.FromImage(bmp).DrawImage(bm, 0, 0, w, h)
> It is so easy with the IntelliSence...
> Greetings
> Martin

Hi Martin,

Thanks, I'll try it! Why do you think this will spare memory?

Thank you.

Freek Versteijn
Hi, Freek Versteijn,

I don't know from which call the OutOfMemory originates, but I tested with a
2 MB bitmap scaling it to ~75% and it was working with the both methods. As
it is stated in the documentation for the GetThumbnailImage method it gives
good quality for 120x120, but lacks in quality for higher resolutions.

http://msdn.microsoft.com/library/e...mageTopic .asp

Greetings
Martin
"Versteijn" <versteijn@.538mail.nl> wrote in message
news:4d19834f.0403010822.54274e09@.posting.google.c om...
> "Martin Dechev" <detcheff_@.hotmail.com> wrote in message
news:<#uSXmc3$DHA.2660@.TK2MSFTNGP10.phx.gbl>...
> > Sorry, it should be another overload:
> > Graphics.FromImage(bmp).DrawImage(bm, 0, 0, w, h)
> > It is so easy with the IntelliSence...
> > Greetings
> > Martin
> Hi Martin,
> Thanks, I'll try it! Why do you think this will spare memory?
> Thank you.
> Freek Versteijn
> > Hi Martin,
> > Thanks, I'll try it! Why do you think this will spare memory?
> > Thank you.
> > Freek Versteijn

Hi Martin,

Changed my code a bit (see under), but ever call to the page uses
about 10-50 mb RAM, which is not freed after the response has been
send. After a while the process can't address any more memory.

The cause of the high memory use is the GetThumbnailImage function.

Regards,

Freek Versteijn

Here is my current code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Request("path") Is Nothing Or Request("width") Is Nothing
Then
Return
End If

Dim bmp As Bitmap = New
Bitmap(Server.MapPath(Server.UrlDecode(Request("path"))))
ResizeImage(bmp, Request("width"), 0)

Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.ContentType = "Image/JPEG"

bmp.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)
Response.End()

'Dispose the image object immediately to limit memory use in
case highres/large images are used
bmp.Dispose()
End Sub

Public Sub ResizeImage(ByRef bmp As Bitmap, ByVal maxWidth As
Integer, ByVal maxHeight As Integer)
Dim imgHeight, imgWidth As Double
Dim bm As Bitmap = New Bitmap(bmp)

imgHeight = bm.Height
imgWidth = bm.Width

If (maxWidth > 0 And imgWidth > maxWidth) Or (maxHeight > 0
And imgHeight > maxHeight) Then
'Determine what dimension is off by more
Dim deltaWidth As Double = imgWidth - maxWidth
Dim deltaHeight As Double = imgHeight - maxHeight
Dim scaleFactor As Double

'If (deltaHeight > deltaWidth) Then
'Scale by the height
'scaleFactor = maxHeight / imgHeight
'Else
' 'Scale by the Width
scaleFactor = maxWidth / imgWidth
'End If

imgWidth *= scaleFactor
imgHeight *= scaleFactor
End If

Dim w As Integer = Convert.ToInt32(imgWidth)
Dim h As Integer = Convert.ToInt32(imgHeight)
Dim inp As IntPtr = New IntPtr
bmp = bm.GetThumbnailImage(w, h, Nothing, inp)
End Sub

Tuesday, March 13, 2012

System.Runtime.InteropServices.COMException: Class not registered

Hello,
I'm trying to develop an ASP.NET application that uses a third-party COM
dll. I've added a reference to the dll in the web app project along with
adding a "using" directive in the code-behind (referencing the COM
namespace). Every time I try and run the application and call methods on th
e
COM object, I get the following error:
System.Runtime.InteropServices.COMException: Class not registered
I've successfully registered the dll using regsvr32 and added
the AspCompat="true" directive on the Page, but doesn't seem to help.
I'd really appreciate any suggestions on how to remedy this problem.
Thanks for your time.
DonnieAre u using VS.NET?
"Donnie" <Donnie@.discussions.microsoft.com> wrote in message
news:2A43630B-C5AE-4AC7-9656-EA496352E760@.microsoft.com...
> Hello,
> I'm trying to develop an ASP.NET application that uses a third-party COM
> dll. I've added a reference to the dll in the web app project along with
> adding a "using" directive in the code-behind (referencing the COM
> namespace). Every time I try and run the application and call methods on
the
> COM object, I get the following error:
> System.Runtime.InteropServices.COMException: Class not registered
> I've successfully registered the dll using regsvr32 and added
> the AspCompat="true" directive on the Page, but doesn't seem to help.
> I'd really appreciate any suggestions on how to remedy this problem.
> Thanks for your time.
> Donnie
>

System.Runtime.InteropServices.COMException: Class not registered

Hello,
I'm trying to develop an ASP.NET application that uses a third-party COM
dll. I've added a reference to the dll in the web app project along with
adding a "using" directive in the code-behind (referencing the COM
namespace). Every time I try and run the application and call methods on the
COM object, I get the following error:

System.Runtime.InteropServices.COMException: Class not registered

I've successfully registered the dll using regsvr32 and added
the AspCompat="true" directive on the Page, but doesn't seem to help.

I'd really appreciate any suggestions on how to remedy this problem.

Thanks for your time.

DonnieAre u using VS.NET?

"Donnie" <Donnie@.discussions.microsoft.com> wrote in message
news:2A43630B-C5AE-4AC7-9656-EA496352E760@.microsoft.com...
> Hello,
> I'm trying to develop an ASP.NET application that uses a third-party COM
> dll. I've added a reference to the dll in the web app project along with
> adding a "using" directive in the code-behind (referencing the COM
> namespace). Every time I try and run the application and call methods on
the
> COM object, I get the following error:
> System.Runtime.InteropServices.COMException: Class not registered
> I've successfully registered the dll using regsvr32 and added
> the AspCompat="true" directive on the Page, but doesn't seem to help.
> I'd really appreciate any suggestions on how to remedy this problem.
> Thanks for your time.
> Donnie