home » blogs » vivek_iit

ASP.NET Blogs

CodeAsp.Net's ASP.NET Blogs is more than just a social community for ASP.NET bloggers - we are one of the largest ASP.NET blog directories on the internet. Whether you are looking to search ASP.NET blogs, connect with ASP.NET bloggers, learn more about ASP.NET, or promote your own blog, CodeAsp.Net is for you. Be sure to check back often as we add new ASP.NET blog postings frequently.

Blogs RSS Feed

vivek_iit : Most Recent postings

ASP.NET MVC vs Web forms

7/9/2010 12:31:59 PM by vivek_iit   -   1 Comments   -   Views: 222

With ASP.NET MVC 3 to be out soon, there are still many developers confused on whether to use MVC or the standard Web Forms UI while building their own custom ASP.NET web applications. I know this has been debated numerous times in the past but let me write on this topic in brief. It would be best to understand this excerpt from the man who created the ASP.NET platform , the great Scott Guthrie : a) Web Forms and MVC are two approaches for building ASP.NET apps. They are both good choices. Each ...

Read More

Convert Int to Enum in C#

5/13/2010 11:47:19 AM by vivek_iit   -   0 Comments   -   Views: 364

Here is some quick code to convert an integer to an enum in C#: Assume we have an enum UserInfoDisplayField Method 1: UserInfoDisplayField myEnum=(UserInfoDisplayFieldType)Enum.ToObject(typeof(UserInfoDisplayFieldType),1)); Method 2: UserInfoDisplayField myEnum=(UserInfoDisplayFieldType)1; You can also check the existence of the enum value before conversion using the Enum.IsDefined field.

Read More

Can I run ASP.NET 2.0 and 3.5 code on the same website?

4/27/2010 9:46:47 AM by vivek_iit   -   1 Comments   -   Views: 830

Run ASP.NET 2.0 and 3.5 applications on the same server Yes, you can run both together, infact the 3.5 applications use the 2.0 compiler. Why? Because version 3.5 is just a wrapper around 2.0 with some additional assemblies. But the newer 4.0 version is a completely new version, and will not be compatible with older versions. That is you cannot compile 3.5 or 2.0 code using 4.0 compiler, IIS will treat them differently too.

Read More

Call C# code within ASPX page

4/26/2010 9:26:31 AM by vivek_iit   -   0 Comments   -   Views: 581

How to call C# code within ASPX page Many times we might need to call the C# or VB.NET code from within the ASPX page instead of using a code-behind file. Here is a quick code snippet to do the same: <%@ Page Language= "C#" %> <script runat= "server" > void Page_Load(object sender, EventArgs e) { MyLabelControl.Text = "time is " + DateTime.Now.ToString(); } //now a button click event handler void Button1_Click(Object sender, EventArgs e) { MyLabelControl.Text = "Clicked at " + DateTi...

Read More

McAfee problem with Windows XP

4/22/2010 5:09:50 AM by vivek_iit   -   0 Comments   -   Views: 277

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Microsoft has been made aware of an issue with a McAfee DAT file update - released Wednesday, April 21, 2010 - that has been causing stability issues on Windows XP client systems. The symptom is caused by a false-positive detection on a core Windows file (svchost.exe). Once the file is quarantined by McAfee, the system may encounter one of the following symptoms: · The computer shuts down when a DCOM error or a RPC error o...

Read More

How to check your website for SEO optimization

4/20/2010 3:59:56 PM by vivek_iit   -   0 Comments   -   Views: 197

Microsoft has a wonderful tool which can easily be installed on your server and gives you detailed reports on SEO-bility of your website, specifically: 1. you can run multiple reports to find out if your site has any major SEO issues. 2. not only does the toolkit identifies SEO issues, but also helps you fix them too. 3. it will index all reachable links on your website and provide detailed link-link analysis. You just need to simply install this toolkit on the webserver where your site is runni...

Read More

How to: Get domain name from Request object in ASP.NET

4/16/2010 12:35:34 PM by vivek_iit   -   0 Comments   -   Views: 537

Suppose you are running your ASP.NET application on a domain like http://www.mydomain.com, and you want to access this domain (www.mydomain.com) in your code. The below method can be used to get the host name: string host= HttpContext.Current.Request.Url.Host; One problem with this is that it will not get port number. For detailed explanation and other possible solutions, refer this link for details: http://forums.asp.net/t/1187298.aspx Here is another solution which handles port number too. htt...

Read More

FormsAuthentication Cookie Issue in IE8

4/3/2010 7:23:06 PM by vivek_iit   -   0 Comments   -   Views: 2468

In one of our products, Communifire, we were dealing with a rather "silly" issue related to persistence of cookies in IE 8. We had created a new easy to implement Single Sign On (SSO) feature which lets users share authentication across parent domain and sub-domain (assuming CF is running on a sub-domain whereas users login via the parent website hosted on the TLD). We were creating a new cookie when user logs in via parent domain and then CF would pick that cookie up and auto-login the user usi...

Read More

Fiddler: No connection could be made because the target machine actively refused it

4/1/2010 10:53:51 AM by vivek_iit   -   0 Comments   -   Views: 1918

While using Fiddler to examine HTTP traffic on your localhost, you may get this error: Fiddler: No connection could be made because the target machine actively refused it This happens because by default .NET bypasses local proxies while sending requests and Fiddler runs as a proxy. One way to catch local HTTP traffic is to change the URL in the browser by appending a "dot" to it (after the localhost), for example: http://localhost:3720/login.aspx becomes, http://localhost.:3720/login.aspx If thi...

Read More

Encoding byte array in C#

3/23/2010 11:14:51 AM by vivek_iit   -   0 Comments   -   Views: 1080

I noticed a developer encoding an already RSA encrypted byte array to a string format, so that he can save it in database. He was using this code: byte[] message = Encoding.UTF8.GetBytes("string to be encrypted"); byte[] encrypted = rsaAlgo.PrivateEncryption(message); string save_in_db = Encoding.UTF8.GetString(encrypted); Then he simply wanted to decrypt save_in_db to its original value, using the following code: byte[] message = Encoding.UTF8.GetBytes(save_in_db); byte[] decrypted = myRsa.Publ...

Read More

Join CodeAsp.Net for FREE Today!

It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.

enter your email address: