<div class="post-body">
<p>
</p>
<div style="CLEAR: both">
</div>
<span style="color:#ff0000;"><strong>First Sample </strong>
</span>
string StrFilePath = Request.FilePath;
int intStart = StrFilePath.LastIndexOf("/") + 1 ;
int intEnd = StrFilePath.LastIndexOf(".aspx");
int intLength = intEnd - intStart; //CHECK THE URL STRING FOR USER SUB DIRECTORY
if(intEnd>0 && intStart>0)
{
StrFilePath = StrFilePath.Substring(intStart,intLength);//TRANSFER THE VISITOR TO
THE COMMON PAGE10:
string strselect ="select fieldname from tablemaster where fieldname='"+StrFilePath.Replace("'","''")+"'";
SqlDataReader Oreader=null;
Oreader=res.getReader(strselect);
if(Oreader.Read())
{
if(StrFilePath.IndexOf("StrFilePath")<0) { Context.RewritePath("Listing.aspx?Id="+Oreader["ID"].ToString()+"");
} } Oreader.Close();
<span style="color:#ff0000;"></span><strong><span style="color:#ff0000;">Second Sample</span>
</strong>
string OriginalPath = HttpContext.Current.Request.Path;
Regex r = new Regex(@"(\d+)");
Match m = r.Match(OriginalPath);
try
{
int id = Convert.ToInt32(m.ToString());
HttpContext.Current.RewritePath("MyPage.aspx?id="+id);
}
catch {}
<span style="color:#ff0000;"><strong>Handling PostBack</strong>
</span>
RegisterStartupScript( "PostBackFix",
"<script> document.forms[0].action=''; </script>
" );</div>