Category: .net framework 2
How to get month date view between two dates in c#
Scenario I got while developing some application. I required month and year view in drop down list between contract starting and ending date. Like “March 2009” “April 2009” until march 2011 so on. I...
how to send mail smtp with authentication with web.mail class
hi i used following code MailMessage message = new MailMessage(); message.To = “myemailaccount@yahoo.com”; message.From = “myemailaccount@thecrystalrosary.com”; message.Subject = “Testing Internet SmtpMail”; message.BodyFormat = MailFormat.Html; message.Body = “body”; message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpserver”, “smtp.thecrystalrosary.com”); message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”, 25); message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusing”, 2); //2...
how to get oracle sequence numbers in .net
hi the main Query to get sequence number is follow select JOB_ID_SEQ.NEXTVAL from dual; i get the required Sequence number value form following method public int GetOracleSequenceValue(string _SequenceValue) { OdbcCommand _command = new OdbcCommand();...
How to resize image in .net
use follwing Code change image path at load event method for downloading Code Imports System Imports System.Drawing Imports System.Drawing.Imaging Imports System.Drawing.Drawing2D Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)...
how to get server.mappath in c# class
i face a problem that server.mappath did not available in c# class at my utillity framework at app code folder of one of my asp.net application. While it is available at asp.net page code...
Design Patterns Interview Questions
What is a Design Pattern? Design Pattern is a re-usable, high quality solution to a given requirement, task or recurring problem. Further, it does not comprise of a complete solution that may be...
Registering ASP.NET on IIS after installing the .NET Framework
Usually this problem occur when we install iIs after installation of Visual studio or .net framework. For this purpose use aspnet_regiis.exe, it is located under %WindowsDir%Microsoft.NETFrameworkvx.y.zzzz and you should call it with the -i...
Transparent Cookie Encryption Via HTTP Module
very nice article about encription of cookies in asp.net http://www.codeproject.com/KB/cs/CookieEncryptionModule.aspx
How to remove duplicate from string array in .net
In one case i have to right a method to remove duplication from array of strings. i write this code Public Function RemoveDuplicates(ByVal items As String()) As String() Dim noDupsArrList As New ArrayList() For...
How to filter uploader control using client side script in asp.net
For any client side action we have to choose a scripting language to build our logic. Let us go for JavaScript. When use a file control we have to use a button control for...
How to get relative path for images in asp.net
One common problem developers face while using master page that images did not get proper path, there are many ways to do this. But best way to use ResolveClientUrl . For example : <img...
How to write word document in asp.net
You can add follwing code at page level function and called in button or page load function Void GenerateWordDoc() { string strDocBody; try { strDocBody = “<html “ + “xmlns:o=’urn:schemas-microsoft-com:office:office’ “ + “xmlns:w=’urn:schemas-microsoft-com:office:word’” +...
How to get Ip of Url in c#
Here is sample code remember to add system.net namespace IPHostEntry ip = Dns.GetHostByName (“www.yahoo.com”); IPAddress [] IpA = ipE.AddressList; for (int i = 0; i < IpA.Length; i++) { Console.WriteLine (“IP Address {0}: {1}...
How to access detailed information of a visitor in asp.net
In ASP.NET, the Request.ServerVariables collection holds a lot of useful information about the visitor. For example: // Getting ip of visitor string ip = Request.ServerVariables[“REMOTE_ADDR”]; // Getting the page which called the script string...
How do I find difference between two dates? In C#
DateTime startDate = new DateTime(2005, 2, 1, 3, 4, 12, 56); // End date DateTime endDate = new DateTime(2005, 12, 12, 4, 30, 45, 12); // Time span TimeSpan diffDate = endDate.Subtract ( startDate...
Compiler Error Message: CS0030: Cannot convert type ‘ASP.login_aspx’ to ‘System.Web.UI.WebControls.Login’
Problem occur when you page name is same as Class in .net Usually we develop the login page as login.aspx . When we publish it, the aspx is retained and tries to compile against...
how to upload larger files in asp.net 2
by default asp.net application did not upload file more than 4.5 mb or 4 mb. For this purpose You have to add following http runtime tag in web.cofig of web site. <httpRuntime executionTimeout=“90“ maxRequestLength=“20096“useFullyQualifiedRedirectUrl=“false“...
how to remove Html tags from string in c#
use this function public string Strip(string text) { return Regex.Replace(text, @”<(.|n)*?>”, string.Empty); }