But wen i pass the same in http.open('HEAD', url1 , false);
Shared folder url is different with http url. And I think httpprotocol not able to handle it. If you wish to browse the shared folder by using http protocol then you have to add the directory as
Virtual Directory at IIS. You can refer to "How To Create a Virtual Directory in Internet Information
Services (IIS)" for more info.
No matter how much time you spend on coding. Wish you happy coding.
My Technical Blog
If this is the requirement, I think you can explore
Impersonate at IIS. So it will throw error if the logon user trying to access a directory which he/she was not granted.
No matter how much time you spend on coding. Wish you happy coding.
My Technical Blog
I have a requirement where once user clicks on a link then by using their windows authentication i have to check if the user have rights to a network folder, if they have then open the folder otherwise redirect them to a different network folder.
I suggest you to use either FTP or HTTP (Virtual Directory) protocol for the network folder. Otherwise I think you will have the difficulty to access them at Browser even the logon user has the permission to access it.
Both FTP and HTTP can be host by IIS. So as long as you able to configure them to Windows Identity then shouldn't be any issue. At the page code behind, you can inspect the permission by simulate a request to the FTP/HTTP url by using HttpWebRequest .
No matter how much time you spend on coding. Wish you happy coding.
My Technical Blog
vishalvl
Member
62 Points
51 Posts
Unable to pass a folder path in URL in javascript
Dec 05, 2012 12:26 AM|LINK
I have the below code to check the URL access for logged in user
<script language="javascript">
<!--
function checkURL(url)
{
try
{
var http = new XMLHttpRequest();
http.open('HEAD', url, false);
http.send();
alert(http.status);
alert(url);
if (((http.status >= 100) && (http.status < 400)) || (http.status == 12029))
{
alert("access available");
return true;
}
}
catch(err)
{
alert("Error : " + err.description);
return false;
}
//alert("No Access");
return false;
}
//-->
</script>
Now i am trying to pass a folder in URL
if (checkURL('\\bluebi\\XXXXXX')==true)
when i check in the alert i get the passed value as "\bluebi\XXXXXX"
when i do if (checkURL('\\\bluebi\\XXXXXX')==true)
i get the some junk value in place of b and then similar URL.
Can someone help me in passing the correct URL so thati can check the access of teh folder for logged in user.
Thanks in advance for help.
CruzerB
Contributor
5399 Points
1098 Posts
Re: Unable to pass a folder path in URL in javascript
Dec 05, 2012 01:01 AM|LINK
Hi,
Decode the url variable will do.
Please refer to : http://www.w3schools.com/jsref/jsref_decodeuricomponent.asp
My Technical Blog
vishalvl
Member
62 Points
51 Posts
Re: Unable to pass a folder path in URL in javascript
Dec 05, 2012 01:14 AM|LINK
Hi,
Thanks for the reply , i did decode
var url1= decodeURIComponent('%5C%5Cbluebird%5CCovadWirelessDocuments');
when i alert this i do get (\\bluebird\CovadWirelessDocuments)
But wen i pass the same in http.open('HEAD', url1 , false);
It gives me error as ''Error: Invalid Argument"
Can you please suggest
Thanks in advance for your help
CruzerB
Contributor
5399 Points
1098 Posts
Re: Unable to pass a folder path in URL in javascript
Dec 05, 2012 01:28 AM|LINK
Shared folder url is different with http url. And I think http protocol not able to handle it. If you wish to browse the shared folder by using http protocol then you have to add the directory as Virtual Directory at IIS. You can refer to "How To Create a Virtual Directory in Internet Information Services (IIS)" for more info.
My Technical Blog
vishalvl
Member
62 Points
51 Posts
Re: Unable to pass a folder path in URL in javascript
Dec 05, 2012 01:34 AM|LINK
Thanks for the info,
Is there any other way by which i can verify if the user have the rights to access the folder by using their windows authentication?
CruzerB
Contributor
5399 Points
1098 Posts
Re: Unable to pass a folder path in URL in javascript
Dec 05, 2012 01:47 AM|LINK
Hi,
If this is the requirement, I think you can explore Impersonate at IIS. So it will throw error if the logon user trying to access a directory which he/she was not granted.
My Technical Blog
vishalvl
Member
62 Points
51 Posts
Re: Unable to pass a folder path in URL in javascript
Dec 05, 2012 01:57 AM|LINK
Thanks for the reply.
I have a requirement where once user clicks on a link then by using their windows authentication i have to check if the user have rights to a network folder, if they have then open the folder otherwise redirect them to a different network folder.
Can you please help now.
Thanks
CruzerB
Contributor
5399 Points
1098 Posts
Re: Unable to pass a folder path in URL in javascript
Dec 05, 2012 02:15 AM|LINK
I suggest you to use either FTP or HTTP (Virtual Directory) protocol for the network folder. Otherwise I think you will have the difficulty to access them at Browser even the logon user has the permission to access it.
Both FTP and HTTP can be host by IIS. So as long as you able to configure them to Windows Identity then shouldn't be any issue. At the page code behind, you can inspect the permission by simulate a request to the FTP/HTTP url by using HttpWebRequest .
My Technical Blog