forum.venkateswarlu.net
      Register      Login
How to Re write the URL?

2 replies to this topic

MalliKarjuna Cherukuri #1
Member
52 Points
Posted on 17 Dec 2011 04:57 PM IST I want to re write the URL which contain Query string as values in the URL are look like folder view. 
Dot Net     1405 views     Reply to this topic
Pasupathi G #2
Member
36 Points
Replied on 19 Dec 2011 03:03 AM IST I think using javascript get the file to url .......

//javascript
function Chg_img(){
var arrIndex;
var arrimage;
var arrurl;
var img_arr=new Array()
arrimage=document.getElementById("<%= hdn_image.ClientID %>").value;
arrurl=document.getElementById("<%= hdn_url.ClientID %>").value;
img_arr=arrimage.split(",");
url_arr=arrurl.split(",");
var maxcount=img_arr.length-1;
arrIndex=document.getElementById("<%= hdn_index.ClientID %>").value;
document.getElementById("<%= ldr_img.ClientID %>").src="../img_side/" + img_arr[arrIndex];///img_side is the foldername
document.getElementById("<%= ldr_href.ClientID %>").href=url_arr[arrIndex];
var nextindex=eval(parseInt(arrIndex)+parseInt(1));
if(nextindex==maxcount){
document.getElementById("<%= hdn_index.ClientID %>").value=0;
}else{
document.getElementById("<%= hdn_index.ClientID %>").value=nextindex;
}
}
function main_ldr_rotate() {
Chg_img();
window.setTimeout("main_ldr_rotate()", 1000);
}


//using c# coding



DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath("~/img_side/"));

//Getting image files
FileInfo[] imgFiles = dirInfo.GetFiles();//filterForImages(dirInfo.GetFiles());
int num = imgFiles.Length;
//ldr_image9.ImageUrl = "~/img_side/" + imgFiles[0].ToString();
StringBuilder sb = new StringBuilder();
StringBuilder sb1 = new StringBuilder();
for (int i = 0; i < num; i++)
{
string filext = imgFiles[i].Extension.ToLower();
if (filext == ".gif" || filext == ".jpg" || filext == ".jpeg" || filext == ".png")
{
string img = imgFiles[i].ToString();
string imgpath = "../img_side/" + imgFiles[i].ToString();
hdn_image.Value = sb.Append(img + ",").ToString();
hdn_url.Value = sb1.Append(imgpath + ",").ToString(); 
Reply to this topic
MalliKarjuna Cherukuri #3
Member
52 Points
Replied on 21 Dec 2011 03:36 PM IST Can you elaborate the code by giving the comments and can you explain how to implement this in .net without hardcoding the url in the web.config file. 
Reply to this topic