
mike55
Avatar/Signature-
Posts
734 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mike55
-
Re: Event logging Yea, that's how I am proceeding at the moment. Once I have completed adding in the extra code, its just sit back and wait for the system to fail. Mike55.
-
We have a server in a web farm, on the server we have a particular web service running that has two methods. One of those methods (StartProcessing()) is responsible for connecting to a database and clearing all the data out of a particular table when it is called. On the same server we have a windows service that is build around a timer, it should run every 5 minutes and call the method StartProcessing() and go to sleep for another 5 minutes before repeating the task. The problem that we are having is that every couple of days the entire system goes down i.e. the windows service fails to call the web service. When we check the server, both the windows and web service appear to be working correctly. I most cases to fix the problem all we have to do is to restart the windows service. In the worst case scenario, we would also restart IIS and the server as a last resort. We have been unable to find out why the windows service stops calling the web service. My money would have been on the windows service loosing the connection to the web service, but I'm not too confident on that been the cause. We have gone through the code and have shown an independent developer the code but no luck there either. Suggestions? Mike55.
-
Solved my problem, I have had to use subreports. Mike55.
-
Hi I am passing a dataset to my crystal report which has two tables, "dstMembers" and "DuesData". Both tables are linked by a Member_ID with the dstMembers containing the primary key. I have created a dataset in my project and have added the Relation between both tables, and in Crystal reports when I view the "Links" tab in the Database expert dialog the link has already been set up. When I go and produce my report and publish it to a .pdf format, my report firstly prints only one record from the "DuesData" at a time i.e. my members name is John Doe, and he has 3 records in the "DuesData" table. That means that The name John Doe is printed out 3 times. Also my report only displays data from the "dstMembers" table if it has records in the "DuesData" table. Any suggestions? Mike55.
-
Yea, that's what I used in the end. When I drag my picture field on my report, it does not display any of the data that exists in the database table. I have tried to insert a picture object and link that to my dataset field but no luck. I managed to do this before using an IBlobField, the problem now is that I can't remember how I did it. Mike55.
-
Problem solved, never placed the code that was called during the page load in an if not page.ispostback statement. Off to hang my head in shame... Mike55
-
I have created a template field and inserting a checkbox into the field. I have name the checkbox as: "chkReceipient". I am trying to loop through the grid and check the checkbox in each row to determine if it is checked or not. If the checkbox is checked do something with that row, otherwise move on to the next row. Here is my code: For inti = 0 To GridView1.Rows.Count - 1 Dim rowCheckBox As CheckBox = GridView1.Rows(inti).FindControl("chkReceipient") If rowCheckBox.Checked = False Then dstMembers.Tables("dstMembers").Rows.Add(myRow) End If Next The problem that I am having is that the rowCheckBox.Checked is returning the value "False" in all cases evenwhen I check the checkbox. Any suggestions? Mike55.
-
I am using crystal reports and using the push method to provide the data to the crystal report from a dataset. Everything is working correctly, in that I am getting back the data and displaying it in my report. The one think that I am having problems with is the sql image type. How can I represent this in an vb.net dataset table, i.e. what is the corresponding datatype System.X? Mike55.
-
Ok, by relocating the location of the fileattached.dispose() as you suggested I got the code to run. However it resulted in the original file and the attachment becoming corrupted. When I try to open the file I get the following message: "Adobe Reader could not open supportDocument.pdf because it is either not a supported file type or because the file has been damaged (it was sent as an email attachment + wasn't correctly decoded)" Mike55.
-
Yea, I'm disposing the attachment just before exiting the if statement, the question that I need to ask is: am I disposing it correctly? If Len(mailAttachment) <> 0 And System.IO.File.Exists(mailAttachment) = True Then Dim fileAttached As New System.Net.Mail.Attachment(mailAttachment) message.Attachments.Add(fileAttached) fileAttached.Dispose() End If I have been searching google, but have been unable to find any posting of a similar problem. Mike55.
-
I am attempting to include a .pdf document as an email attachment. The following is the code that I am using: Dim smtpClient As New SmtpClient Dim message As New MailMessage SendEmail = True Try ' Gets the SMTP Email credentials If GetEmailAccountDetails(emailSmtp, emailUser, emailPass) = True Then Dim fromAddress As MailAddress = New MailAddress(sender) Dim smtpAuthentication As New System.Net.NetworkCredential(emailUser, emailPass) 'Sets the smptclient properties smtpClient.Host = emailSmtp smtpClient.UseDefaultCredentials = False 'Sets the smpt port and Authentication smtpClient.Port = 25 smtpClient.Credentials = smtpAuthentication 'Set Message message.From = fromAddress message.To.Add(receipient) message.Subject = subject message.IsBodyHtml = True message.Body = messageBody 'Sets the Attachement if required If Len(mailAttachment) <> 0 And System.IO.File.Exists(mailAttachment) = True Then Dim fileAttached As New System.Net.Mail.Attachment(mailAttachment) message.Attachments.Add(fileAttached) fileAttached.Dispose() End If If Len(mailAttachment2) <> 0 And System.IO.File.Exists(mailAttachment2) = True Then Dim fileAttached As New System.Net.Mail.Attachment(mailAttachment2) message.Attachments.Add(fileAttached) fileAttached.Dispose() End If 'Sends the message smtpClient.Send(message) Else Return False End If Catch ex As Exception Return False Finally End Try I am passing in the location of the file in the following format: C:\mylog\templates\supportdocument.pdf However when I try to attach the file I get a System.Net.Mail.Smtpexception that tells me "Failure sending mail" with the inner message being: "Cannot access a closed file" Any suggestions? I have checked and have the necessary permissions, I'm sure. Sometimes, the code also seems to corrupt the file as when I try to open the file I get the message: "Adobe Reader could not open supportDocument.pdf because it is either not a supported file type or because the file has been damaged (it was sent as an email attachment + wasn't correctly decoded)" Michael.
-
Problem solved, must use a wildcard certificate. Can anyone recommend a suitable provider? Mike55.
-
Hi all I have two sites, both are related in that one provides administration functions for the second site. One of the developers that I work with says that it should be possible to share the same SSL certificate between both sites, but that he hasn't tried it ever. Has anyone tried this before, or can it even be done? I have tried to set it up but no look. In IIS, I have my default web site, and a new web site linked to http://www.xxx.com, inside the site I have a folder (virtual directory) for my admin program. I have an ssl certificate for the web site and it is operating correctly. Mike55.
-
Hi all Here is the code for a .dll that allows you to query the payment gateway provided by the Maltese based company Endeavour. Feel free to use it, critique it, or edit it. If you decided to either edit or critique it, I would appreciate it if you posted details on why you did what you did, or any other comments. Mike55. PaymentsGateway.zip
-
I have an application on a shared hosting space, On one page I am uploading files, .jpg to be exact to a folder in my application. I am however experiencing a Security Exception with the error message: It would appear that I need to adjust the trust permissions of my web application. Browsing through the internet I found the following code that I am suppose to enter into the web.config file: <location allowOverride="false"> <system.web> <securityPolicy> <trustLevel name="Full" policyFile="internal"/> <trustLevel name="High" policyFile="web_hightrust.config"/> <trustLevel name="Medium" policyFile="web_mediumtrust.config"/> <trustLevel name="Low" policyFile="web_lowtrust.config"/> <trustLevel name="Minimal" policyFile="web_minimaltrust.config"/> </securityPolicy> <trust level="Medium" originUrl=""/> </system.web> </location> Here is my web.config file: <?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <location path="About.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Lands.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Photo1.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Photo2.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Contact.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Default.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="myError.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="LandRegistry.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="myProperty.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="FTP.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <system.web> <authentication mode="Forms"> <forms name="www.iveraghmart.ie" loginUrl="Admin/Login.aspx" timeout="20" slidingExpiration="true" cookieless="UseCookies"/> </authentication> <authorization> <deny users="?"/> </authorization> <customErrors mode="Off"/> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> </pages> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </assemblies> </compilation> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </httpModules> <httpRuntime maxRequestLength="25600" /> </system.web> <system.web.extensions> <scripting> <webServices> <!-- Uncomment this line to customize maxJsonLength and add a custom converter --> <!-- <jsonSerialization maxJsonLength="500"> <converters> <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/> </converters> </jsonSerialization> --> <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. --> <!-- <authenticationService enabled="true" requireSSL = "true|false"/> --> <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. --> <!-- <profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" /> --> </webServices> <!-- <scriptResourceHandler enableCompression="true" enableCaching="true" /> --> </scripting> </system.web.extensions> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </handlers> </system.webServer> </configuration> When I drop the above code into my web.config file as is, I get a number of exceptions that relate to the <location allowOverride="false> Any suggestions? Mike55.
-
I have changed the cmd from: System.IO.Path.GetFullPath(FileUpload1.FileName) to: System.IO.Path.GetFullPath(FileUpload1.PostedFile.FileName) [code] and it appears to work correctly. Any comments? Mike55.
-
Hi all I am using the asp.net upload control to help in uploading files to a ftp folder. When I call the following: System.IO.Path.GetFullPath(FileUpload1.FileName) on the control (FileUpload1) I get the following result: "C:\WINDOWS\system32\img1.JPG". My problem is that the file that I browsed to is not at this location, but instead at "C\img1.JPG". Can anyone suggest why I am getting a different file location? Mike55.
-
I agree with you on Excel messing up the data, i.e. if you have a mobile/telephone number, Excel knocks off the leading 0 if one exists. Not sure that I like the idea of having the users to access another program, nor am I likely to get approval for such an application. Will keep on searching, if I come across anything of use, I will get back to you with it. Mike55.
-
I have a page that currently accepts a .csv file and takes the records in that file and saves them to the database. I have a series of rules that are used to determine if each record is to be inserted or updated. I originally chose .csv so people could access it with notepad, however I quickly found out that MS Excel to control of the file and was responsible for maintaining the file. Since Excel did this, my users have been experiencing a large number of problems with submitting data using the .csv approach. How would others recommend doing it? I considered .xml, but again Excel takes control. Also the problem with .xml is that the user has to be familiar with xml and its structure. Given that the majority of my users are not computer literate, I can see huge problems with this approach. Mike55.
-
I am having a problem with visual studio.net 2005 in that it has become corrupted. I have tried to repair the application using the visual studio.net cd, and I have tried to remove the application using add/remove programs. Neither of these approaches work, is there anyway that I can safely remove visual studio without wiping the entire machine? Mike55
-
Re: Web service Have previously used web services with windows services, however I ran in the problems, in that the windows service seems to have lost its reference to the web service. Don't particularly want to get caught out again a second time. Is there a simple way of supplying a web references, without right clicking on references and going "add web reference"? Mike55.
-
I am trying to set up a monitoring service for a database. Originally I had a windows service running on the same machine as the database and querying the database every 10 minutes. It was possible to change the time automatically by changing a value that I was storing in the machine's registry. I have been told that I need to relocate this service, as if the machine goes down, the service will not be available. I have been told also that opening the sql server (2005) to allow remote connections is not an option. The solution that I am hoping to use is to install a web page (.aspx) on the same machine as the database and use my windows service installed on another machine to send web requests to the web page, and get a specific web response. This is the code that I would be using to sending the request and retrieving the response: WebRequest wRequest; WebResponse wResponse; System.IO.StreamReader sReader; wRequest = System.Net.HttpWebRequest.Create("http://127.0.0.1/WebMonitor/Monitor.aspx"); wRequest.Method = "GET"; wResponse = wRequest.GetResponse(); sReader = new System.IO.StreamReader(wResponse.GetResponseStream()); String result; result = sReader.ReadToEnd().Trim(); sReader.Close(); The problem that I am having is that I am unable to find any information on providing my own specific response from the web page. The value that I need to send back is a float. Any suggestions on how I can do this? Mike55.
-
Here it is: Public Shared Function RetrievePhoto(ByVal id As String, ByVal photo As Int16, ByRef content As String) As Byte() Dim sqlCmd As SqlCommand connection = New SqlConnection(consql) Try 'Open the database connection. If connection.State = ConnectionState.Closed Then connection.Open() End If Catch ex As Exception GoTo end1 End Try Try myDsDataset = New DataSet myAdapter = New SqlDataAdapter Dim myDataReader As SqlDataReader = Nothing 'Retrieve the data. Select Case photo Case 0 sqlCmd = New SqlCommand("SELECT (Pict1) as Pict, (Content1) as Content FROM Lands where ref = " & id & "", connection) myDataReader = sqlCmd.ExecuteReader Case 1 sqlCmd = New SqlCommand("SELECT (Pict2) as Pict, (Content2) as Content FROM Lands where ref = " & id & "", connection) myDataReader = sqlCmd.ExecuteReader End Select Dim myArray As Byte() = Nothing Do While myDataReader.Read If myDataReader("Pict") Is System.DBNull.Value Then myArray = Nothing GoTo xyz End If myArray = myDataReader.Item("Pict") content = myDataReader.Item("Content") Loop xyz: 'Return the data back to the user. Return myArray Catch ex As Exception Finally 'Close the database connection. If connection.State = ConnectionState.Open Then connection.Close() End If End Try end1: End Function Mike55.
-
Hi, I am storing images in my database, where I am using 3 columns for each image, 1. imageName as an nvarchar(50), 2. imageData as an image, and 3. imageType as an nvarchar(100). I have successfully inserted the images into the database, only problem that I am having is that I am unable to do any sort of compression on the images, but that's a different problem. The issue that I am having is that if I try and retrieve two images from the database and display them at the same time, in some cases only 1 image is displayed while in other cases no image is displayed. To display the images, I have created a web control with two html image controls with runat="server", both these controls have the image url set to a different .aspx page which use the following code to retrieve the image from the database and display it: Private Sub LoadImage() Dim myReader As Byte() Dim content As String = String.Empty myReader = dbConnection.RetrievePhoto(Request.QueryString("pid").ToString, 0, content) Try Response.ContentType = content If Not myReader Is Nothing Then Response.BinaryWrite(myReader) Else Response.WriteFile("images/Notfound.jpg") End If Catch ex As Exception End Try End Sub In the event that the images don't display, I have manually gone to the pages which runs the above code, and I have confirmed that the code is running correctly and displaying the images. Any suggestions on how to correct this problem? I think that it may be down to the size of the images, so they are causing some sort of timeout during execution of my code, but I cannot be positive. Mike55.
-
Try the following code, it has worked for me recently: 'Allow a file to be uploaded to a web server using FTP. Public Shared Function uploadFileUsingFTP(ByVal CompleteFTPPath As String, ByVal CompleteLocalPath As String, Optional ByVal UName As String = "", Optional ByVal PWD As String = "") As String uploadFileUsingFTP = Nothing Dim resultMsg As String = "Upload complete" Try 'Create a FTP Request Object and Specfiy a Complete Path Dim reqObj As FtpWebRequest = WebRequest.Create(CompleteFTPPath) 'Call A FileUpload Method of FTP Request Object reqObj.Method = WebRequestMethods.Ftp.UploadFile 'If you want to access Resourse Protected You need to give User Name and PWD reqObj.Credentials = New NetworkCredential(UName, PWD) 'FileStream object read file from Local Drive Dim streamObj As System.IO.FileStream = System.IO.File.OpenRead(CompleteLocalPath) 'Store File in Buffer Dim buffer(streamObj.Length) As Byte 'Read File from Buffer streamObj.Read(buffer, 0, buffer.Length) 'Close FileStream Object Set its Value to nothing streamObj.Close() streamObj = Nothing 'Upload File to ftp://localHost/ set its object to nothing reqObj.GetRequestStream().Write(buffer, 0, buffer.Length) reqObj = Nothing Return resultMsg Catch ex As Exception resultMsg = ex.Message End Try End Function myFtp.uploadFileUsingFTP("ftp://yahoo.com/abc/about.txt", _ System.IO.Path.GetFullPath(FileUpload1.FileName).ToString, _ "username", "password") The first parameter that you pass is the target location and the new file name. Mike55.