Link to home
Start Free TrialLog in
Avatar of Panda 5888
Panda 5888

asked on

Failed to open network folder from ASP.NET application

I used the following code to open network folder:
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl =  "\\fileshare" Text="View related documents" Target="_blank">        </asp:HyperLink>

It runs well in server 'A' but not server 'B',
Both server running in win2008 IIS7. Kindly advise how to fix it
Avatar of udaya kumar laligondla
udaya kumar laligondla
Flag of India image

It's just a hyper link that you are creating, it's not dependent on server.  

What is the error are you getting ? Server error or client error ?

Post the error details or screen shots.
Avatar of Panda 5888
Panda 5888

ASKER

There is no error shown. When click on the link, fileshare folder is not open. Applying same code to another server and it did open up the folder.
Right click on the hyper link and copy the link using "copy link address" in chrome or "copy shortcut" in IE.
For both the servers and check the difference you are getting in the hyper link target.
Avatar of Prakash Samariya
Use UNC path for network sharing file\folder path like below
"file://///<ServerName>/<ShareFolder>/<FileName>"

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl =  "file://///fileshare" Text="View related documents" Target="_blank">        </asp:HyperLink>

Open in new window

I've requested that this question be deleted for the following reason:

Need to repost question
You could give a correction comment if the issue is with the clarification of error. If the content of the question is wrong then it will be a new question.

I think it's not fair to delete question after solutions are suggested.
Further checking showed that same issue happen in both server.
It works fine if click from http://server01/application/Default.aspx instead of http://server01.domainserver.com/application/Default.aspx

By removing the '.domainserver.com' the folder can be open without issue.
Have you checked the hyper link target of the resulted link. Post the hyper link result. You can use "file://targetpath" as link as suggested by "Prakash"
User generated imageExamine the links generated by both servers. That may show the issue. Post the hyper links generated
Both are showing same result
file://fileshare/
ASKER CERTIFIED SOLUTION
Avatar of Prakash Samariya
Prakash Samariya
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Use This

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl =  "file://fileshare"  Text="View related documents"  Target="_new" />

and try