ViewBag – ViewData – TempData objects
August 11, 2011 by taxi · Leave a Comment
All of them are properties of Controllers and Views, and all of them are used to transport very sm
Import Google Contacts – ASP.NET
January 27, 2011 by taxi · Leave a Comment
How can we download our google address book to some local DB, file etc? One of the coolest things google has provided for developers is the Google Data API for integration of user and google applications. And for importing google contacts, firstly we need to download Google Data API and install them to get the [...]
Cloud Computing – ASP.NET
January 26, 2011 by Nauman · Leave a Comment
Following are some of pros and cons for Cloud Computing Architecture for ASP.NET: Advantages: Cost cutting More storage for Data. Mobilitiy of Data Easy Disaster Recovery Disadvantages Implementation of session Implementation of authentication Migration of existing application
Retrieving domain information through ASP.NET
December 24, 2009 by Nauman · Leave a Comment
There are many domain checking websites available that gives all the information regarding domains. WhoIs is one of them. Following is a sample asp.net code that connects to one of WhoIs servers and retrieve information of a specific website. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net.Sockets; using System.IO; [...]
Add meta data dynamically
Add meta-data dynamically to your page by adding a HtmlMeta control to your Header. In this example I dynamically add a keyword string to the page. string keyWords = “metatags, html, dynamic, generate”; HtmlMeta keywords = new HtmlMeta(); keywords.Name = “keywords”; keywords.Content = keyWords; Page.Header.Controls.Add(keywords);
Date Time string formatting in ASP.NET
With the following code you can format a DateTime within a Databind. <%# DateTime.Parse(Eval("DateModified").ToString()).ToString("MM-dd-yyyy")%> Some more format specifiers that can change format of datetime objects the way it is required. Format specifier Name d Short date pattern D Long date pattern t Short time pattern T Long time pattern f Full date/time pattern ( short [...]
Easy way to Export dataset in Excel
November 5, 2009 by Nauman · Leave a Comment
Fastest way to export dataset in excel format is: DataSet dsExport = new DataSet(); System.IO.StringWriter tw = new System.IO.StringWriter(); HTMLTextWriter hw = new HTMLTextWriter(tw); DataGrid dg = new DataGrid(); dg.DataSource = "Dataset to be exported" hw.WriteLine ("<b><font size=’3′>Exported report</font></b>"); dg.DataBind(); Response.ContentType = "application/vnd.ms-excel"; EnableViewState = false; Response.Write(tw.ToString()); Response.End();
Crystal Report Viewer width – Visual Studio
November 5, 2009 by Nauman · Leave a Comment
By default Crystal report viewer width is fixed according to it toolbar, but changes due to amount of data present in the report. And the width is not editable (as it is seen). Because of this reason if a crystal report has good amount of data then it goes past page width and disturbs the [...]
Securing ASP.NET Web applications – Beginner’s article
November 5, 2009 by Nauman · Leave a Comment
Want to secure a web application. A very good article relating to ASP.NET web application security hacks, and prevention techniques are defined at a beginner level. A good article for beginners, those who want to secure their applications. Article Here
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154
November 3, 2009 by Nauman · 14 Comments
Sometimes when working with office Interop assemblies the above mentioned error occurs. I had also got the same when using Microsoft Excel interop assembly and adding its reference in my ASP.NET application. The problem is that by default when Microsoft Excel is used as a COM object then it can only be [...]