Monday, March 22, 2010

XML Path Query

Hello Friends,
Here I provide you one link that will share you how to use xml in sql server.

http://beyondrelational.com/blogs/jacob/archive/2008/08/04/for-xml-path-how-to-remove-the-lt-row-gt-element-from-the-output-of-a-for-xml-path-query.aspx


Hopes it will help for beginners.

Regards,
Kinjal

Monday, March 15, 2010

Create MessageBox user control using ASP.NET and CSS

Hello friends,
I read one article that will shown how an importance of handling different message types properly.

So here I just put the link of that article.
http://www.jankoatwarpspeed.com/post/2008/05/28/Create-MessageBox-user-control-using-ASPNET-and-CSS.aspx

I hopes you are also interest in it.

Regards,
Kinjal

Friday, March 12, 2010

Embeded Script

<object width="610" height="420" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="flvplayer.swf" name="movie" />
<param value="high" name="quality" />
<param value="never" name="AllowScriptAccess" />
<param value="opaque" name="wmode" />
<param value="file=610x420_700kbps_fulldvd.flv&image=../plumbing/pictures/preview.jpg"
name="FlashVars" />
<embed width="610" height="420" pluginspage="http://www.macromedia.com/go/getflashplayer"
allowscriptaccess="never" type="application/x-shockwave-flash" flashvars="file=540x380_400kbps_fulldvd.flv&image=../plumbing/pictures/preview.jpg"
wmode="opaque" src="flvplayer.swf" /></object>

Tuesday, March 2, 2010

Redirect from Http to Https in ASP.NET

Hello frnds,
In my one project, there is a requirement for redirect some page from HTTP to HTTPS.
So find one great article that will help me. So here I post the link of that article and code of how its work.

http://www.xdevsoftware.com/blog/post/Redirect-from-Http-to-Https-in-ASPNET.aspx

Code:-
-------------------------------------------------------
Class File Name: SecurePages.cs
-------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Collections.Specialized;
#region "SecurePage Class"
public class SecurePage
{
string _path = "";
string _pathType = "";

public string Path
{
get { return this._path; }
set { this._path = value; }
}

public string PathType
{
get { return this._pathType; }
set { this._pathType = value; }
}
}
#region "SecurePath Class"
public class SecurePath
{

public static bool IsSecure(string path)
{
List lstPages = new List();

bool isSecure = false;

try
{
//Fill the list of pages defined in web.config
NameValueCollection sectionPages = (NameValueCollection)ConfigurationManager.GetSection("SecurePages");

foreach (string key in sectionPages)
{
if ((!string.IsNullOrEmpty(key)) && (!string.IsNullOrEmpty(sectionPages.Get(key))))
{
lstPages.Add(new SecurePage { PathType = sectionPages.Get(key), Path = key });
}
}

//loop through the list to match the path with the value in the list item
foreach (SecurePage page in lstPages)
{
switch (page.PathType.ToLower().Trim())
{
case "directory":
if (path.Contains(page.Path))
{
isSecure = true;
}
break;
case "page":
if (path.ToLower().Trim() == page.Path.ToLower().Trim())
{
isSecure = true;
}
break;
default:
isSecure = false;
break;
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}

return isSecure;
}
}
#endregion

#endregion


/* Add New custom section in web.config */

<configuration>
<configSections>
<section name="SecurePages" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<SecurePages>
<add key="/admin" value="directory" />
<add key="/WebForm2.aspx" value="page" />
<add key="/WebForm1.aspx" value="page" />
<add key="/myDir/myDirSec" value="directory" />
</SecurePages>
</configuration>