String bday = "06/20/2010";
DateTime ukDateFormat = DateTime.Parse(bday, System.Globalization.CultureInfo.GetCultureInfo("en-us"));
Response.Write(ukDateFormat);...
more »
I was working on a project and have been asked to convert the webpage into a pdf document. I have found a solution in a forum, but it was in c#, I have converted it in VB.net. See below method to convert a webpage into a PDF document.
First, you need to download iTextSharp. iTextSharp is a port of the iText open source java library which allows you to generate PDF files on the fly.
Once you downloaded the library, you need to reference it in your project. To reference the downloaded the ...
more »
Simply copy and paste the following code into the root htaccess file of your site to enjoy a serious reduction in wasted bandwidth, stolen resources, and comment spam.
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} almaden [OR]
RewriteCond %{HTTP_USER_AGENT} ^Anarchie [OR]
RewriteCond %{HTTP_USER_AGENT} ^ASPSeek [OR]
RewriteCond %{HTTP_USER_AGENT} ^attach [OR]
RewriteCond %{HTTP_USER_AGENT} ^autoemailspider [OR]
RewriteCond %{HTTP_USER_AGENT} ^BackWeb [OR]
RewriteCond...
more »
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 »