PsychoDazey
asked on
Refresh Link in Internet Explorer
I have an app that converts files to a pdf and places them in a folder on a network. These folders are linked to our intranet. The problem right now is that the link does not refresh itself, it has to be done manually. Is there a way to programatically have Internet Explorer refresh the links to thes files?
<META HTTP-EQUIV=Refresh CONTENT="20; URL=http://www.bob.com/">
What do you mean by refresh the links? Do you want the page to refetch (retrieve a fresh copy), or refresh? Or do you want to have the links get updated href's without reloading the page?
ZRH
ZRH
ASKER
Right now if we replace a file (or add a file for that matter) the owner of that page has to reset the link because it is broken once the file is removed (or not there when a new file is added). I want the page to automatically update so it has hyperlinks to all of the documents in that folder.
Well, you could try FrontPage Extensions, or you could enable Directory Browsing in IIS. (Or you could wait until I finish my file browser web control :)) There probably won't be an *easy* solution unless you use the two aforementioned. I'll have to think about it..
Hope that helps some,
ZRH
Hope that helps some,
ZRH
How about let all links point to a general APSX page, passing the image as parameter.
Then in that ASPX page you can look for the image using the System.IO namespace to browse through the folders.
D'Mzz!
RoverM
Then in that ASPX page you can look for the image using the System.IO namespace to browse through the folders.
D'Mzz!
RoverM
ASKER
let me look into the front page extensions, I hadn't thought about that.
I'll get back to you.
Thanks all
I'll get back to you.
Thanks all
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oh, forgot to mention that this line
Dim sFolders As String = GetAllFolders(Server.MapPa th("./"))
initializes the root folder from where to search.
All subfolder will be included automaticly.
D'Mzz!
RoverM
Dim sFolders As String = GetAllFolders(Server.MapPa
initializes the root folder from where to search.
All subfolder will be included automaticly.
D'Mzz!
RoverM
Quoted from above, in c#
-------------------------- ---------- -
Here's an example:
Add this to your code behind:
using System.IO;
Put this in your page_load:
string sDoc = Request["doc"];
string sFolders = GetAllFolders(Server.MapPa th("./"));
if(!sFolders.Equals(String .Empty)) {
string[] arr = sFolders.Split({'|'});
string sResult = "";
for(int i= arr.GetLowerBound(0), top = arr.GetUpperBound(0); i < top; i++) {
sResult = SearchForFile(arr[i], sDoc)
if(!sResult.Equals(String. Empty))
break;
}
if(!sResult.Equals(String. Empty)) {
Response.Write("Found: " + sResult);
} else {
Response.Write("File not found!");
}
} else {
Response.Write("No folders found!");
}
As you can see I put a request variable in sDoc. So when calling this page it should be something like:
Server.Transfer("getdocume nt.aspx?do c=YOURDOCU MENT.DOC", false);
Then add these functions:
private string GetAllFolders(string sPath) {return GetAllFolders(sPath, "");}
private string GetAllFolders(string sPath, string sSub) {
DirectoryInfo dirroot = new DirectoryInfo(sPath);
if(!dirroot.Exists()) {
// folder not found!!
return "";
}
string sResult = "";
string sSubFolder;
DirectoryInfo[] dirs = dirroot.GetDirectories("*. *");
foreach(DirectoryInfo fld in dirs) {
sResult += fld.FullName + "|";
sSubFolder = sSub + "\" + fld.Name;
if(fld.GetDirectories("*.* ").Length > 0) {
sResult += GetAllFolders(fld.FullName , sSubFolder);
}
}
return sResult;
}
private string SearchForFile(string sFolder, string sFile) {
DirectoryInfo dirroot = new DirectoryInfo(sFolder);
if(!dirroot.Exists()) {
//folder not found!!
return "";
}
FileInfo[] fls = dirroot.GetFiles("*.*");
if(fls.Length > 0) {
foreach(FileInfo fl in fls) {
if(fl.Name.ToLower().Equal s(sFile.To Lower())) {
return fl.FullName;
}
}
}
return "";
}
Hope that helps,
ZRH
--------------------------
Here's an example:
Add this to your code behind:
using System.IO;
Put this in your page_load:
string sDoc = Request["doc"];
string sFolders = GetAllFolders(Server.MapPa
if(!sFolders.Equals(String
string[] arr = sFolders.Split({'|'});
string sResult = "";
for(int i= arr.GetLowerBound(0), top = arr.GetUpperBound(0); i < top; i++) {
sResult = SearchForFile(arr[i], sDoc)
if(!sResult.Equals(String.
break;
}
if(!sResult.Equals(String.
Response.Write("Found: " + sResult);
} else {
Response.Write("File not found!");
}
} else {
Response.Write("No folders found!");
}
As you can see I put a request variable in sDoc. So when calling this page it should be something like:
Server.Transfer("getdocume
Then add these functions:
private string GetAllFolders(string sPath) {return GetAllFolders(sPath, "");}
private string GetAllFolders(string sPath, string sSub) {
DirectoryInfo dirroot = new DirectoryInfo(sPath);
if(!dirroot.Exists()) {
// folder not found!!
return "";
}
string sResult = "";
string sSubFolder;
DirectoryInfo[] dirs = dirroot.GetDirectories("*.
foreach(DirectoryInfo fld in dirs) {
sResult += fld.FullName + "|";
sSubFolder = sSub + "\" + fld.Name;
if(fld.GetDirectories("*.*
sResult += GetAllFolders(fld.FullName
}
}
return sResult;
}
private string SearchForFile(string sFolder, string sFile) {
DirectoryInfo dirroot = new DirectoryInfo(sFolder);
if(!dirroot.Exists()) {
//folder not found!!
return "";
}
FileInfo[] fls = dirroot.GetFiles("*.*");
if(fls.Length > 0) {
foreach(FileInfo fl in fls) {
if(fl.Name.ToLower().Equal
return fl.FullName;
}
}
}
return "";
}
Hope that helps,
ZRH
ZRH: Can I contact you if I want some code translated from VB to C#?? ;-)
Roverm: Sure :)
roverm, there are also automated .NET translators
http://www.remotesoft.com/octopus/try.html
http://authors.aspalliance.com/aldotnet/examples/translate.aspx
http://www.kamalpatel.net/ConvertCSharp2VB.aspx
Hey it is all .NET under this fancy dress (call it C#, VB.NET whatever)
There are minor non-directly convertible commands between C# and VB.NET.
Kind Regards,
Zlatin
http://www.remotesoft.com/octopus/try.html
http://authors.aspalliance.com/aldotnet/examples/translate.aspx
http://www.kamalpatel.net/ConvertCSharp2VB.aspx
Hey it is all .NET under this fancy dress (call it C#, VB.NET whatever)
There are minor non-directly convertible commands between C# and VB.NET.
Kind Regards,
Zlatin
For example, C# doesn't support default member initializers for functions. :(
Yes, but notice that all these features are not part of the CLI standard.
ASKER
Thanks guys, I think I have what I need here! I split points because I ended up using pieces from both of you.
http://www.htmlhelp.com/reference/html40/head/meta.html