I'm 14 and I am really stuck. I wish to have an ASP.NET webpage that will enable users to create a new account in an organizational container. I have seen many pages on this but I just keep getting stuck.
Also, if this is possible, once the user has signed up would it be possible to run a script to enable the user for Office Communications Server 2007, or will I have to set the script as a cron job every 2 minutes?
Thanks in advance for your help.
Here is how I do it in a classic asp page:
Set objContainer = GetObject("LDAP://OU=OUtoPut,DC=YOUR,DC=ORG")
Set objUser = objContainer.Create("User", "CN=" & strCN)
objUser.sAMAccountName = strCN
objUser.givenName = strFName
objUser.sn = strLName
objUser.FullName = strCN
objUser.displayName = strCN
objUser.UserPrincipalName = strCN & "#your.org"
objUser.SetInfo
objUser.SetPassword strPass
objUser.pwdLastSet = 0
objUser.SetInfo
objUser.AccountDisabled = False
objUser.SetInfo
probably a little overdone toward the end with the setinfos, but it works.
Related
When I open a T-Code from SAP GUI, some of the fields are pre-populated from past queries. Is it possible to enter a T-Code and all the fields in the next window to be forced blank?
I develop scripts for SAP GUI and run into problems if fields already have content from prior queries.
The history cannot be disabled user-wise. Period.
Either all or nobody.
If you want to disable the history go to SAPgui options into Local data setting
The history in Windows is a simple Access MDB file but it is password-protected, so you may try to crack it and delete only your user lines but it is a bunch of work.
However, I guess the history that makes you crazy is not what I described above, but SPA/GPA parameters. Check it first
You can empty some fields with :
""
session.findById("wnd[1]/usr/ctxtRMMG1_REF-BWTAR").Text = ""
But doesn't work all the time...
My method for this is to loop through all the fields (and recursively on all children elements) and set the text value of them to an empty string.
On read-only fields it throws an error and this is why "On Error Resume Next" is necessary.
Sub Start_Clearing()
'setup SAP
If Not IsObject(SAPApplication) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApplication = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = SAPApplication.Children(0)
End If
If Not IsObject(Session) Then
Set Session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject Session, "on"
WScript.ConnectObject SAPApplication, "on"
End If
Dim UserArea As Object
Set UserArea = Session.findByID("wnd[0]/usr")
Clear_Fields UserArea
End Sub
'_______________________________
Sub Clear_Fields(Area As Object)
Set SAPApplication = GetObject("SAPGUI").GetScriptingEngine
Dim Obj As Object
Dim NextArea As Object
On Error Resume Next
For i = 0 To Area.Children.Count - 1
Set Obj = Area.Children(CInt(i))
If Obj.ContainerType = True Then
If Obj.Children.Count > 0 Then
Set NextArea = SAPApplication.findByID(Obj.ID)
Clear_Fields NextArea
End If
End If
Obj.Text = ""
Next i
End Sub
within a page ASP (classic) I have a function that connects to the server via XMLHTTP to google to get the time and distance between two points.
I noticed that sometimes my server makes this request very slowly sending the script out and blocking the page.
I would therefore ask you.
If I change the attached script to say
if the execution time exceeds five seconds then stops the script
function GooDistInd(origine,destintario)
Set objxml = Nothing
' Dichiaro le variabili che mi servono nello script
Dim file, objXmlHttp, objXmlDom, distanza, cognome, i
'http://maps.google.com/maps/api/directions/xml?origin=40.7143528,-74.0059731&destination=40.7035458,-74.21607971&sensor=false
file = "http://maps.googleapis.com/maps/api/directions/xml?origin="& origine &"destination="&destintario &"&sensor=false"
Set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
objXmlHttp.Open "GET", file, False
objXmlHttp.Send
Set objXmlDom = Server.CreateObject("Microsoft.XMLDOM")
objXmlDom.async = False
objXmlDom.loadXML(objXmlHttp.responseText)
Set tempo = objXmlDom.getElementsByTagName("leg/distance/value")
i = 0
For i = 0 To tempo.length - 1
distanza=tempo(i).Text
exit for
Next
GooDistInd =distanza
end function
If you want to stop the script completely you could use
Server.ScriptTimeout = 5
You could also use the timeut property of the Microsoft.XMLHTTP object and set it to 5000 ms. In this case you could work with on error resume next and check if an error occurred, so you could give back a significant error message to you users
I was Creating a website in Classic ASP Project, having a Logout feature.
I want to access the login database and make changes, when the session ends. The coding is something like:
In global.asa :
Sub Session_OnEnd()
Set studcon = Server.CreateObject("ADODB.Connection")
studcon.Open "Provider = Microsoft.JET.OLEDB.4.0;Data Source = E:\mailfan.mdb"
Set studrec = Server.CreateObject("ADODB.Recordset")
studrec.Open "login", studcon, 1, 3
studrec.movefirst
found = 0
Do While studrec.EOF or found = 1
If studrec("ID") = Session("uid") Then
studrec("log") = 0
studrec.Update
End If
studrec.movenext
Loop
studrec.close
studcon.close
Set studrec = Nothing
Set studcon = Nothing
End Sub
But Even After Session.Abandon the value of log field Remains the same (It is 1 when session's active).
Small Update: I tried to google it, and did recieve a very similar link having the same question: http://www.justskins.com/forums/problem-with-global-asa-77015.html
But the code is the same as suggested by Aaron Bertrand in the above link. Is it due to IIS 8.0? Because I would be Running it on Win XP sp3 IIS 6. And I Do require it to work there.
I can't see an SQL query anywhere in your code. If you're intent on using a recordset for your update then in place of
studrec.Open "login", studcon, 1, 3
you should have something like
studrec.Open "select * from login", studcon, 1, 3
This assumes that your database table is called "Login"
Using a recordset is actually an over complex means of doing all this though, An Update query should suffice. You could remove all your code from
Set studrec = Server.CreateObject("ADODB.Recordset")
to
studrec.close
and replace it with
studcon.Execute("UPDATE Login set log = 0 where id = " & Session("uid"))
I had inherited a website to do general maintenance on. The web pages are ASP pages but the bulk of my work has been with the html/css. The site has been working fine for a number of years, that is until now. When I try to load pages that are containing VB script I receive the following error:
Microsoft VBScript runtime error '800a01a8'
Object required: '[object]'
/new_products.asp, line 12
the name of the asp page changes based on the page that is being called, but the line reference is the same.
The code that is generating the error is as follows:
Dim objXMLHTTP
Dim coordinates
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
ip = Request.ServerVariables("REMOTE_ADDR")
objXMLHTTP.Open "GET", "http://www.ippages.com/xml/?ip="&ip&"&get=country", False
objXMLHTTP.Send
Set xmldoc = objXMLHTTP.responseXML
country = xmldoc.selectSingleNode("ip_address/lookups/lookup_country").text
set objXMLHTTP=nothing
theCountry = Trim(UCASE(country))
If theCountry = "CA-CANADA" then
Bags = "13.99"
SB4Pack = "14.00"
currency_code = "CAD"
lc = "CA"
Pref = "$"
ShipType = 1
ElseIf theCountry = "US-UNITED STATES" then
Bags = "13.99"
SB4Pack = "14.00"
currency_code = "USD"
lc = "US"
Pref = "$"
ShipType = 2
Else
Bags = "8.00"
SB4Pack = "11.00"
currency_code = "GBP"
lc = "UK"
Pref = "£"
ShipType = 2
End If
With my extremely limited knowledge of VB I have done my best to try and figure out why the code has stopped working, but I am stumped. Any and all help is greatly greatly appreciated.
Since this is an environment specific issue which started to popup recently as you mentioned... No sure statement can be provided. You need to investigate it. What one can do is to suggest some thing. I believe your problem is one of this statement.
Set xmldoc = objXMLHTTP.responseXML
country = xmldoc.selectSingleNode("ip_address/lookups/lookup_country").text
Probably this value is not coming or Null or Nothing.Try to print the value of country if it's coming as Null, Nothing... Later when you try to change the case of country.... You can use tools to capture the Http request and response tools like Fidler to verify what is coming in lookup_country as a value or whether you are getting this node or not.
Also where is theCountry is declared. If it's dynamic variable then check if some one enabled OptionExplicit??
I have taken over a departing programmer's Classic ASP object, and I'm trying to debug some DAC code. The trouble is I don't really understand what DAC is or how it works -- and I can't find were the DAC code "lives".
Here's the individual line of code:
set runObj = server.CreateObject("DAC.clsDb_container")
We use SQL Server, and I looked in Enterprise Manager under Stored Procedures and User-Defined functions, but I don't see anything named clsDB_container.
Any suggestions where I can find the code for this DAC object?
The full code in context:
FUNCTION getNewGUID
Dim runCON, runObj, runCMD
DebugWrite( "<BEGIN> iRoutines.asp|getNewGUID (a) GUID=" & GUID & " dealernum=" & dealernum )
set runObj = server.CreateObject("DAC.clsDb_container")
if not runObj.run_query("EXEC sproc_createGUID") then
traperror(runObj.DB_ErrStr)
else
GUID = replace(runObj.get_by_ordinal(0),"-","")
dealernum_len = trim(cstr(len(dealernum)))
set runObj = nothing
end if
getNewGUID = dealernum_len & dealernum & GUID
DebugWrite( "<END> iRoutines.asp|getNewGUID (b) getNewGUID=" & getNewGUID & " dealernum=" & dealernum )
END FUNCTION
This looks like a custom COM object that was written as a data access layer for the site.
The name of the object would be DAC.clsDb_container and lives in a DLL somewhere on the web server.
It is not standard - you will need to look for (I am guessing here) the VB6 or Delphi code that created it if you want to be enlightened further.
if all you need is a GUID then you could do this
<%
Function createGuid()
Set TypeLib = Server.CreateObject("Scriptlet.TypeLib")
dim tg : tg = TypeLib.Guid
createGuid = left(tg, len(tg)-2)
Set TypeLib = Nothing
End Function
%>