473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

javascript and ASP

AnuSumesh
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
4 1772
JamieHowarth0
533 Expert 512MB
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
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
Sorry I go it.
Its using jscript as server side scripting in asp pages.

Thanks a lot

Anu
Oct 22 '08 #4
JamieHowarth0
533 Expert 512MB
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

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

Similar topics

0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.