Create shortcut  to a website from ASP.net web page.

zameer21
zameer21 used Ask the Experts™
on
Create shortcut  to a website from ASP.net web page on click of event.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Praveen VenuTechnical Project Manager

Commented:
in the javascript try

<script language="Javascript">

var WshShell = new ActiveXObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
var oShellLink = WshShell.CreateShortcut(strDesktop + "\\shorcut.url");
oShellLink.TargetPath = "http://myurl.com";
oShellLink.Save();

</script>

Commented:
Hey zameer,
do you mean desktop shortcut to the site??

Thanks and regards,
venki

Author

Commented:
yes venki
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Author

Commented:
praveen,
i tried your code but WShshell object return nothing.
Praveen VenuTechnical Project Manager

Commented:
are you using IE?

Author

Commented:
I am using IE and most users will use IE, i tried the code above but on our system Active X is disabled.
Ted BouskillSenior Software Developer
Top Expert 2009

Commented:
This will not work.  Access to the client system is blocked by default to prevent malicious web sites from harming the users system.

Author

Commented:
Can i do it using asp.net
Senior Software Developer
Top Expert 2009
Commented:
No.  By design a page in a web browser has very, very limited access to the client.  Basically it can write values in a cookie and that is it.  A web page isn't even allowed to change or access the browser history.  That is by design to protect the client.

This has absolutely nothing to do with the type of client operating system or browser and the type of server you are accessing to request the page.  The web page and server are not allowed to change anything on the client.
Ted BouskillSenior Software Developer
Top Expert 2009

Commented:
http:#26447367 is the correct answer.  It can't be done.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial