By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,848 Members | 3,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,848 IT Pros & Developers. It's quick & easy.

javascript and ASP

AnuSumesh
P: 96
Hi All,

I have some asp code that is using dll shareaccessext.dll and its methods via creaing its object. My code is as follows:
Expand|Select|Wrap|Line Numbers
  1. funcion getobj()
  2. {
  3. var obj = null;
  4.     var x = Request.ServerVariables("AUTH_TYPE"), 
  5.         apppath = Request.ServerVariables("APPL_PHYSICAL_PATH").Item;
  6.  
  7.     var xHeaderName,xHeaderValue = "";
  8.     var xHeaderPass  = "";
  9.     var bHasPassword = true;
  10.  
  11.     var isBasicAuth = (x == "Basic"), useBasicAuth = 0;
  12.     var isAdminSite = (apppath.indexOf("\\AdmPages") > 0);
  13.     try {
  14.         obj = new ActiveXObject("ShareAccess.ShareEnum");
  15.         obj.SetSiteData(Request.ServerVariables("SERVER_NAME"), Request.ServerVariables("LOCAL_ADDR") ,Request.ServerVariables("SERVER_PORT"));
  16.         useBasicAuth = obj.BasicAuth((isAdminSite) ? 1 : 2);
  17.         xHeaderName = obj.HeaderName;
  18.     }
  19.     catch (e)
  20.     {
  21.         useBasicAuth = -1;
  22.         xHeaderName = "";
  23.     }
  24.  
  25.     if(obj == null)
  26.     {
  27.         Response.Redirect("/InternalSite/InternalError.asp?error_code=201")
  28.         return null;
  29.     }
  30.  
  31.     if(useBasicAuth && isBasicAuth) {
  32.         xHeaderValue = new String(Request.ServerVariables("REMOTE_USER"));
  33.         xHeaderPass  = new String(Request.ServerVariables("AUTH_PASSWORD"));
  34.     }
  35.     else if(x != "") //if not anonymous logon - use the iis impersonation
  36.     {
  37.         xHeaderValue = new String(Request.ServerVariables("REMOTE_USER"));
  38.         xHeaderPass  = new String("whl_dummy_ntlm_password");
  39.     }
  40.     else if(xHeaderName != "") {
  41.         xHeaderValue = new String(Request.ServerVariables(xHeaderName).Item);
  42.         bHasPassword = false;
  43.     }
  44.     else {
  45.         xHeaderValue = new String(Request.ServerVariables("REMOTE_USER"))
  46.     }
  47.  
  48.     try {
  49.         obj.SetSecurityInfo("FileAccess", Request.ServerVariables("HTTPS"), Request.ServerVariables("REQUEST_METHOD"));
  50.         if (bHasPassword == true) {
  51.             Retval = obj.SetUserDataFromHeaderUserPass(xHeaderValue, xHeaderPass);
  52.         }
  53.         else {
  54.             Retval = obj.SetUserDataFromHeader(xHeaderValue);
  55.         }
  56.  
  57.         if(!Retval){
  58.             var i = xHeaderValue.indexOf(':');
  59.             if(i <= 0)i = xHeaderValue.length;
  60. //            Response.Write("Error logging on user " + xHeaderValue.substr(0,i));
  61.             if (apppath.indexOf("e-Gap")!=-1)
  62.                 Response.Write("Error logging on user " + xHeaderValue.substr(0,i) + " - Wrong Credentials Supplied.");
  63.             else
  64.                 Response.Write("Error logging on user " + xHeaderValue.substr(0,i) + " - Possible Misconfiguration Problem.");
  65.             Response.End();
  66.         }
  67.     }
  68.     catch(e){
  69.         Response.Write("Error " + e);
  70.         Response.End();
  71.     }
  72.  
  73.     apppath = Request.ServerVariables("PATH_INFO").Item;
  74.     if(isAdminSite && (apppath.indexOf("novell_nt_login.asp") < 0) && !obj.IsAdminUser){
  75.         Response.Write("You have no permissions to configure Secure File Access Application.");
  76.         obj = null;
  77.         Response.End();
  78.     }
  79.  
  80.     return obj;
  81. }
  82.  
One exe file is also present in same folder as dll file and asp file.

The dll shareaccessext.dll is at server side.
This code is executed when clien access webpage from browser.
I am geting confused how javascript can access serverside dll file and its methods.

Its urgent plzzzzz

Thanks n Regards
Anu
Oct 21 '08 #1
Share this Question
Share on Google+
4 Replies


codegecko
Expert 100+
P: 533
Hi Anu,

Please remember to use [ CODE] and [/ CODE] tags in future around your code (remove the spaces).

Is the above code Javascript? It looks like it contains parts of ASP code in there (Request.Querystring), which wouldn't work in the way that you are using them.

If you've created a DLL and it resides on the server, to get it to interact with Javascript would require the use of AJAX to call server-side code to manipulate an instance of the DLL (which would either have to be an ActiveX object or a COM+ object). You can't get Javascript to execute stuff on the server on it's own, it's a purely client-side scripted programming language.

Hope this helps.

codegecko
Oct 21 '08 #2

AnuSumesh
P: 96
Hi

I am agree with you.
Its not my code. Actually i have to understand this code and need to copy some of the methods of dll used in this code.
I am also confused, b'coz javascript can't be used for server side programming.

Files are on server side. Same folder contains one dll, one exe and asp programs.
The code that i posted is part of asp file. I am guessing javascript As its using javascript syntax. No ajax is used here.

Can you plz explain me which language is used here in asp?
I doubt if its JSP syntax.I am totally confused as pages are saved as .asp and is using some java syntax for server side coding.
Plzzzzzzzz help me.

Regards,
Anu
Oct 22 '08 #3

AnuSumesh
P: 96
Sorry I go it.
Its using jscript as server side scripting in asp pages.

Thanks a lot

Anu
Oct 22 '08 #4

codegecko
Expert 100+
P: 533
Taking a look over your code, I was going to suggest that it might be JScript but I wasn't too sure so I thought I'd ask if there was any AJAX involved to clear up any ambiguity.

Anyways, I'm glad to hear you got it sorted :-)

codegecko
Oct 26 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.