Archive for November, 2008
  • If you are writing a program to send a mail with an attachment, then you might come across the problem with some random ATTXXXXX.dat file.if you you don't attach a file with the email, then by default ASP.NET will send a weird random ATTxxxxxxx.dat file. To bypass this, put a validation in the file attachment.If Not String.IsNullOrEmpty(AttachmentFileFiled.FileName) Then put the attachment code here ' e.g mm.Attachments.Add(New Attachment(AttachmentFileField.PostedFile.InputStream, Attac... more »
  • I found a nice article about how to send emails using System.Net.Mail on asp.net forums. Have a look at asp.net forum... more »
  • I found a nice article about how to send emails using System.Net.Mail on asp.net forums. Click the following link to access the page asp.net forum... more »
  • This code should be in yourfilename.aspx.vb . Const maxFileSize As Integer = 1048576 Dim intDocFileLength As Integer = Me.AttachmentFile.PostedFile.ContentLength If intDocFileLength > maxFileSize Then Label1.Text = "File size exceeds the limit of 1MB." Exit Sub End If *AttachmentFile is the name of the fileupload control ID.... more »
  • If you want to filter the filetype in a fileupload control: < asp:FileUpload ID="AttachmentFile" runat="server" Width="240px" style="background-color: #FFF0E1" /> < asp:RegularExpressionValidator id="FileUpLoadValidator" runat="server" ErrorMessage="Th file type is not allowed." ValidationExpression="^.+(.doc|.DOC|.pdf|.PDF)$" ControlToValidate="AttachmentFile" style="font-size: x-small" > This will only allow to upload doc and pdf file types. You could use other methods to ... more »
  • If you want to limit the number of characters in a text field use the code below: < asp:TextBox runat="server" ID="Body" TextMode="MultiLine" MaxLength="5" Columns="55" Rows="10" BackColor="#FFCC99" Width="346px" style="background-color: #FFF0E1"> < asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="Body" Display="Dynamic" ErrorMessage="25 char... more »
  • How to use the 'RegularExpressionValidator' and 'RequiredFieldValidator' in ASP.NET: I have used these to validate an email address. see the code below: < asp:TextBox runat="server" ID="Email" Columns="30"> < asp:RequiredFieldValidator ID="EmailValidator" runat="server" ControlToValidate="Email" display="Dynamic" ErrorMessage="Email must be filled out" /> < asp:RegularExpressionValidator ID="EmailValidator2" runat="server" ControlToValidate="ToEmail" Display="Dynamic" ... more »
  • * I have used VB in this demonstration. If you want to handle the error for the whole application in ASP.NET, you could use the global.asax. Put the below code in global.asax under Application_Error(). Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when an unhandled error occurs Dim currentException As Exception currentException = Server.GetLastError.GetBaseException() Response.Redirect("/error.aspx?Err=" & Server.UrlEn... more »
  • Its nothing exciting, but just wondering why Google doesn't validate the SPACE character. If you search any keywords on Google it will either display the results or it will display the not found message e.g, if you search '.', it will display "Your search - . - did not match any documents" BUT, try this URL! http://www.google.co.uk/search?hl=en&q=+&btnG=Search&meta= If you get the message saying "Tip: Save time by hitting the return key instead of clicking on "search"" then press ENTER!... more »
  • This is quite old but a cool trick! Step 1: Open Notepad Step 2: Write following line in the notepad. sanj can not crack Step 3: Save this file as test.txt Step 4: Close the notepad. Step 5: Open the file again. :)... more »
Page 1 of 212
My Networks

Follow me in these Social Networks

Categories
Photos
DSC02695 DSC02754 India Trip Scene 1 DSC02669 DSC02773 DSC02709 DSC02785 DSC02726 DSC02742
sanjeeve
Archives