Web Forms :: FileUpload For Images Stopped Working
Apr 16, 2010
I have a web app that allows users to upload images. Last week, all was well. This week, it appears the code is breaking. Here is the code:
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
If FileUploadControl.HasFile Then
Dim month As String = ddlMonth5.SelectedValue
Dim year As String = ddlYear7.SelectedValue
' Dim whatis As String = FileUploadControl.PostedFile.ContentType
Try
If (FileUploadControl.PostedFile.ContentType = "image/jpeg") Or (FileUploadControl.PostedFile.ContentType = "image/pjpeg") Or (FileUploadControl.PostedFile.ContentType = "image/gif") Or (FileUploadControl.PostedFile.ContentType = "image/x-png")
Then
Dim fs = New FileStream(FileUploadControl.PostedFile.FileName, FileMode.Open, FileAccess.Read)
'save file with new size
Using image As System.Drawing.Image = System.Drawing.Image.FromStream(fs)
Using bitmap As New Bitmap(image)
bitmap.Save("C:WebsitesimagesCusRespData.jpg", image.RawFormat)
bitmap.Save("C:Websitesimages" & month & year & "CusRespData.jpg", image.RawFormat)
End Using
End Using
StatusLabel.Text = "Upload status: File uploaded!"
fs.Close()
fs = Nothing
Else
StatusLabel.Text = "Upload status: Only .jpg,.jpeg,.gif and .png files are accepted!"
End If
Catch ex As Exception
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " & ex.Message
End Try
StatusLabel.Visible = True
End If
End Sub
On the development side, I see this error: The file could not be uploaded. The following error occurred: Could not find a part of the path. On the production side, this occurs: The following error occured: A generic error occurred in GDI+.
Until the Dec 29th my website was working fine. Then My fileupload problems started happening. My fileupload page would simply quit and say the page can not be found. I maximized all my timeout settings and that did not work. I called my hosting company and apparently they have no problem using my page to upload files from their geographical area. So then I concluded it might be a network problem. I ran a trace route and could not really figure out where the problem was. So, I have no idea what is going on. Is it possible that my site is being blocked by some black list out there somewhere?
I have a c# control class inside of a dll, then this control is embedded in a web page in an asp.net application by using the object tag. When the dll is compiled with .net 3.5 sp1 and the web application also runs in .net 3.5 sp1, the code works fine. But when the dll is compiled in .net 4.0 and the web application runs in 4.0, the control does not show up in the web page. All I see is a box with an object icon in the upper left corner.
I have a .net 1.1 ASP application (domain.com) which has a .net 2 virtual directory (domain.com/v2) beneath it, both applications run within their own app pool on the same Windows Server 2003 machine running IIS 6. The web.config files for both apps are setup for Forms Authentication as described here - [URL]
Users would be directed to the domain.com/v2/login.aspx page which would authenticate for both applications, this configuration has been working fine for the last few years until installing one of the recent Windows 2003 security updates today. Now after authenticating under /v2 users keep getting redirected back to domain.com/v2/Login.aspx as domain.com doesnt see them as authenticated anymore.
which security update would have caused this and if its possible to fix or rollback?
Iam working on VWD express 2010, and things were going well, when the VWD crashed.I recovered my work and and realized that my controls stoped firing events.I removed and added button again, but in vain. I set "AutoEventWireup" and reset it also, but no use.I changed the code onto multiple systems. But the events wont fire. (I kept breakpoints also) My Web.config looks like this
I have been using a datagrid on various pages. For some reason it stopped working. When pressing the Edit to make a change to the record, the page posts back two times and the record does not go into the edit mode. I am using IE 7 for my browser. Below is my code.
I'm still building). After loggin in, users are presented with 3 radio buttons (they work), and 3 cascading drop downs (they work). Below that is an AJAX Accordion with 5 panes, each pane has a tabpanel with 4 tabs, 2 of the tabs have gridviews that change based on who is logged in and the radio buttons and dropdowns above
I have designed a basic web user control to enter some values in a table. The control worked fine if it is used without similar control on same page. When another instance is pasted with different id, then both stopped working.
Am in the middle of developing 2 projects and my AJAX Toolkit has stopped working, which is also stopping my designer filers being generated. Have the same problem in both projects. A sample error is below: Warning 3 Generation of designer file failed: Unable to create type 'cc1:CollapsiblePanelExtender'. Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
C:UsersHuwDocumentsMy Web SitesRegent2Regent2Master.Master 169 0 Regent2
The reason I have the update panel outside the Tabcontainer is so that when switching between tabs, the screen doesn't flicker with refreshes, etc. But as a result, I can't get the FileUpload working properly. The FileUpload1.Filename is blank, so it errors out.
Is there anyway to get this working properly? I've tried the latest AsyncFileupload within the control toolkit, but this caused all kinds of problems with my pages so that's out of the question. I tried an iFrame too, but this also didnt work properly.
I've just upgraded a visual studio.net 2003 project (asp.net 1.1) to visual studio.net 2010 (asp.net 4.0). I'm encountering a problem with viewing Crystal reports. I'm using Visual Studio Development Server as a Web Server.
When I try to create a new report (via code that worked fine previously) the line below causes the webserver40.exe to crash.
Protected WithEvents MyRep As New CrystalDecisions.CrystalReports.Engine.ReportDocument
I'm just getting started with MVC and I created a new MVC 2 C# project. Visual studio defaults it to .net 4 but since my hosting provider is still on 3.5 I went into properties and set my project to target .net 3.5. However when I did this a piece of my code stopped working.
I have an HttpHandler which takes care of 404 errors, which I implemented years ago as a way of doing url routing. If the request maps to a valid page, it redirects to that page. Otherwise, it returns a 404. (I know I should start using the new routing feature of asp.net 4.0, but that will take some time. I need to get this working asap.)
In IIS6, I have mapped the 404 error to "/404.ashx". In the web.config, custom errors are set up like so:
This has been working for years - it stopped working as soon as I changed the site to use asp.net 4.0. Everything was recompiled for 4.0, and there were no code changes.
Now, when I hit one of these urls that used to work, I get a blank page with a 404 error code. If I remove the IIS 404 error mapping, I get a regular old 404 page. It seems that the httphandler is not being called.
I have other http handler which are working fine. I figure there must be some configuration setting I missed or something like that. Naturally, this is a problem only on my production server, so I can't run it in the debugger to see what is happening.
I have some services deployed on [URL]I want to move them to [URL]. I have [URL] physically hosted & has its own web.config file. No inheritance issues...
I configured the subdomain (through my host--I don't actually own the web server) so that the subdomain is physically hosted & made sure it's running as an IIS application.
When the services lived on [URL], I used the following address prefixing in web.config:
[Code]....
Now that they're on [URL], I modified the web.config to read:
I'm having a problem with my 3rd cascading dropdown no longer displaying the list. I've obviously made a change somewhere but I cannot see it so I'm hoping some extra eyes will spot the problem. If it matters, I am using VWD 2010 Express, SQL Express, .NET 4.0I have checked the datasets and they are returning the proper list based on the input criteriahere is the pertinent code:
I had the strangest bug yesterday while trying to debug in vs.net 2005....
I had an '05 web application. I clicked the "Run" button to start debugging, and the webpage popped up fine. I could run through the pages fine. Everything seemed fine....UNTIL!
Until I tried to start inserting breakpoints into my code. The application ignored them. In addition, I noticed my little green visual studio "Start Debugging" arrow (which is normally greyed out while in debug mode) was green. It was as if visual studio completely detached itself from my website I was trying to debug.
After playing around with it for a while, I realized I also had a vs.net 2008 solution open as well. My '08 solution wasn't in debug mode or anything, it was just sitting there open. I just happened to close it, not thinking anything of it, and presto! My 2005 debugger started working again!
So basically, I can't debug an '05 solution (or at least a web solution, as that's all I tried) while I also have an '08 solution open.
I have added autocompleteextender in page . It was working without parameters , when i have added parameters "pretext","count" it stops working. below are my code :
<div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="~/Admin/WebService1.asmx" /> </Services> </asp:ToolkitScriptManager> <asp:TextBox ID="TextboxCompletelist" runat="server"></asp:TextBox> <asp:AutoCompleteExtender ID="TextboxCompletelist_AutoCompleteExtender" runat="server" ServiceMethod="GetCompletionList" Enabled="True" ServicePath="~/Admin/WebService1.asmx" TargetControlID="TextboxCompletelist" CompletionSetCount="10"> </asp:AutoCompleteExtender> </div> namespace AgentService [WebService(Namespace = [URL] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] [System.Web.Script.Services.ScriptService] public class WebService1 : System.Web.Services.WebService { [WebMethod] public static string[] GetCompletionList(string PrefixText, int count) { string countryname; SqlParameter[] parm = new SqlParameter[1]; parm[0] = new SqlParameter("@PrefixText", PrefixText); DataTable dt = SqlHelper.ExecuteDataset(AppSetting.ActivateConnection, CommandType.StoredProcedure, "FetchAutoCompleteStates",parm).Tables[0]; List<string> items = new List<string>(); for (int i = 0; i <= dt.Rows.Count-1; i++) { countryname = dt.Rows[i]["statename"].ToString(); items.Add(countryname); } return items.ToArray(); }
Iam trying to upload around 10-12 different images and vedio using seperate separate FileUpload but when I pressed submit button it will show "This page cannot be displayed" and not execute the code.
I recently ran into some strange problems. Changes to files that are not code-behind (and not gets compiled to a DLL) should not require you to recompile the whole website, and this has never been I problem for me. These should actually get compiled dynamically when you first access the resource, e.g. the first time when browsing an updated aspx-page in the browser.
But yesterday, during development of a website, I noticed that even the smallest changes in html, javascript or anything in the .aspx-files doesn't get reflected when I save and reload the page in my browser. Rebuilding doesn't help either, actually I'll have to do a "Rebuild All" (in Visual Studio 2008) in order to see the changes. This applies to all aspx-files in my project.
I tried with minor changes on files in another web application project on the same server, and there it works as it should. Something must has happened to this particular application, but I cannot figure out what. Do you have any ideas on how to solve this?