Jump to content
Sign in to follow this  
OCRedRoadster

Make a URL link shortcut on the server to an ASP page when a new record created in the DB

Recommended Posts

Hello, first post here at W3Schools. I made an older ASP project for tracking jobs at work.

 

Part of the ASP app saves specific job details to a MS access database table.

When the job is first created in the DB, one job (root) folder with two subfolders are created on the server at that same time.

 

serverjobs11452

serverjobs1145211452 PHOTOS

serverjobs1145211452 RESEARCH

 

set foldername=fso.CreateFolder(newpath) set foldername=fso.CreateFolder(newpath & "" & strJobFolderNumber & " PHOTOS") set foldername=fso.CreateFolder(newpath & "" & strJobFolderNumber & " RESEARCH")

 

The structure of the job folders on the server is such that only the first time a job is created the root folder and 2 subfolders are created in the newly created root job folder (eg. 11452).

Subsequent jobs with the same root job number (eg. root 11452 then later 11452-2) do not trigger the creation of an additional job (root) folder or subfolders within the job root folder.

 

Another part of the application supports a job management page for tracking job progress as they move through the business process. The job management page is accessed with a link in one ASP page to another ASP page (passing a value to access the DB and build the page) that is created server side and returned in a new browser window.

 

format of the link for a typical job management ASP page for jobs 11452 and 11452-2:

 

http://server/jobs/JobMgmtResponse.asp?hdnJobNumber=11452&submit=GO

http://server/jobs/JobMgmtResponse.asp?hdnJobNumber=11452-2&submit=GO

 

How would I do this:

 

I would like to create and place a link (shortcut?) to the job management ASP page, on the server, in the job number root folder (eg. serverjobs11452) for each job saved to the DB with the same root job number.

 

These would be created for the first job (eg. 11452) and subsequent jobs (eg. 11452-2, 11452-C) as jobs are added to the DB

 

Each job with the same root job number saved in the DB needs to have a link (shortcut) to the job management ASP page that can be directly accessed when viewing any particular job's root directory (eg.serverjobs11452) on the server and returned to the requesting browser.

This link needs to be saved on the server in the root job folder.

 

I've done research into this and cannot find a way to format a link or shortcut to the job's management page dynamically with ASP as a job is added to the DB then save it to the job root directory.

 

Please give me a hand with this. I'm not sure it can be done or maybe I'm not approaching it from the right perspective. Thanks

 

 

 

 

 

 

Edited by OCRedRoadster

Share this post


Link to post
Share on other sites

I'm not sure what you're trying to do, are you trying to save a file in the directory that someone can double-click on to go to a particular URL?

Share this post


Link to post
Share on other sites

I'm not sure what you're trying to do, are you trying to save a file in the directory that someone can double-click on to go to a particular URL?

 

Yes. The file saved as a link or shortcut to the ASP page formatted like this typical example: http://server/jobs/JobMgmtResponse.asp?hdnJobNumber=11452&submit=GO

saved in the job directory on the server to open a link to the manangment page and when clicked will open it in a new browser window on the client side

Share this post


Link to post
Share on other sites

I'm not sure what you're trying to do, are you trying to save a file in the directory that someone can double-click on to go to a particular URL?

 

Does anyone know - can ASP do something like this? Or any guidance on how to get this functionality? Thanks

Share this post


Link to post
Share on other sites

Windows Explorer supports a .url file that you can save on the server, when someone double-clicks on the file it will launch a browser with various options that you set in the file. The .url file is just a text file, similar to a .ini file. There's a list of some of the options you can use here:

 

http://www.fmtz.com/formats/url-file-format/article

 

The FileSystemObject can save files if you're not aware of that. Look up a reference for the FileSystemObject to see examples of what it can do.

Share this post


Link to post
Share on other sites

Windows Explorer supports a .url file that you can save on the server, when someone double-clicks on the file it will launch a browser with various options that you set in the file. The .url file is just a text file, similar to a .ini file. There's a list of some of the options you can use here:

 

http://www.fmtz.com/formats/url-file-format/article

 

The FileSystemObject can save files if you're not aware of that. Look up a reference for the FileSystemObject to see examples of what it can do.

 

I will see how to use the windows explorer .url file type. I was unaware of this type

 

Thank you for the info. I looked at the FileSystemObject before and I will revisit it to see if it can be used to save a file to the server. Thanks for the help

Share this post


Link to post
Share on other sites

Windows Explorer supports a .url file that you can save on the server, when someone double-clicks on the file it will launch a browser with various options that you set in the file. The .url file is just a text file, similar to a .ini file. There's a list of some of the options you can use here:

 

http://www.fmtz.com/formats/url-file-format/article

 

The FileSystemObject can save files if you're not aware of that. Look up a reference for the FileSystemObject to see examples of what it can do.

 

I revisited the FileSystemObject and found a way to create a file on the server in the right directory with the correct name for what was needed.

 

'Set objTextStream=fso.OpenTextFile(newpath & "" & strJobNumberChecked & ".url", fsoForWriting, True)'objTextStream.WriteLine("[DEFAULT]")'objTextStream.WriteLine("BASEURL=http://server2/jobs-db/JobMgmtResponse.asp?hdnJobNumber=" & strJobNumberChecked & "&submit=GO")'objTextStream.WriteLine("[internetShortcut]")'objTextStream.WriteLine("URL=http://server2/jobs-db/JobMgmtResponse.asp?hdnJobNumber=" & strJobNumberChecked & "&submit=GO")'objTextStream.WriteLine("IDList=")'objTextStream.WriteLine("[{000214A0-0000-0000-C000-000000000046}")'objTextStream.WriteLine("Prop3=19,2")

 

Looking at the created file in a text editior. It looked fine. And when cut and pasted into a different and fuctional shortcut file, it worked.

 

[DEFAULT]BASEURL=http://server2/jobs-db/JobMgmtResponse.asp?hdnJobNumber=9901-2&submit=GO[internetShortcut]URL=http://server2/jobs-db/JobMgmtResponse.asp?hdnJobNumber=9901-2&submit=GOIDList=[{000214A0-0000-0000-C000-000000000046}Prop3=19,2

 

However, I have only been able to create a file that "looks" like a .url and is named using the .url extension (in the ASP code and has the right .url icon in the directory). I know I used the Create TextFile but when I used the .txt extension in the ASP code I of course got a text file in the directory on the server with same contents as above URL properties above. If I left off the extension it created an unknown file type.

 

When I used the .url extension the file looked good but it didnt open the page in the browser and when I looked at the properties of the shortcut produced (right-click properties) I found it was different than a functional shortcut by not having the "Web Document" tab. Not sure why...except the create TextFile in the FSO.... I will continue trying but...

 

Anyone know how to make afunctional shortcut file in this case? The help and clues would be appreciated much. Thanks

Share this post


Link to post
Share on other sites

Well, the .url file IS a text file. Files are generally either text files or binary files. If you can open the file in a text editor like Notepad and read the contents, then it's a text file. Creating a text file with a .url extension is the correct way to do it. What happens when you double-click on the file? I don't see any information online that you would need to do anything extra other than giving the file a .url extension and formatting the contents correctly. Are you sure everything is formatted correctly? I see that IDList starts with an open square bracket but doesn't having a closing one, is that a problem?

Share this post


Link to post
Share on other sites

Well, the .url file IS a text file. Files are generally either text files or binary files. If you can open the file in a text editor like Notepad and read the contents, then it's a text file. Creating a text file with a .url extension is the correct way to do it. What happens when you double-click on the file? I don't see any information online that you would need to do anything extra other than giving the file a .url extension and formatting the contents correctly. Are you sure everything is formatted correctly? I see that IDList starts with an open square bracket but doesn't having a closing one, is that a problem?

 

Thank you very much justsomeguy for seeing the lack of a closing bracket in my result above. Indeed that was the problem which was preventing the shortcut file from functioning correctly when double-clicked. I changed the line of code and it now works just as I want it to. Thanks again

Edited by OCRedRoadster

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×