|
Hi all.
First thing of all, I am an absolutly newbie on asp programming.
We are developing an application which works this way:
A user validate through an asp.net page, a script at the server search an especifical attribute on AD, and redirect the user to an OWA page depending of that value without having to validate again on OWA page.
I can make the AD search script working, but when I mix this code with an xmlhttp to pass credentials to the owa page, it fails. I obtain an "ActiveX component can't create object: 'ADODB.Command'" error.
Here is my code:
<title>Single Sign-on
Dim objCommand, objConnection, strBase, strFilter, strAttributes
Dim strQuery, objRecordset, strUser, objRootDSE, strDNSDomain, strURL
Dim oXMLHTTP
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" & strUser & "))"
strAttributes = "extensionAttribute1"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 20
objCommand.Properties("Cache Results") = False
objCommand.Properties("Size Limit") = 1
objRecordset = objCommand.Execute
Do Until objRecordset.EOF
If IsDBNull((objRecordset.Fields("extensionAttribute1").value)) <> True Then
strURL = "https://exc2k3/Exchange/"
Else
strURL = "https://exc2k7/Exchange/"
End If
objRecordset.MoveNext()
Loop
objRecordset.Close()
objConnection.Close()
Sub cmdGet_OnClick()
strUser = document.all.USER.Value
strPW = document.all.PW.Value
Set oXMLHTTP = CreateObject("microsoft.xmlhttp")
oXMLHTTP.Open "HEAD", strURL, True, strUser, strPW
oXMLHTTP.onreadystatechange = getRef("XMLHTTPStateChange")
oXMLHTTP.send ("")
End Sub
Sub XMLHTTPStateChange
strURL = document.all.URL.Value
if (oXMLHTTP.readystate <> 4) then
exit sub
end if
open(strURL)
End Sub
OWA
User:
Password:
|
|
|
|
|
Hi,
I currently have a repeater that renders a series of dropdowns depending on data returned from the database.
When the user clicks next on the screen I want to cycle through the dropdowns in the repeater and stored the selectedindex of each into an array that will then be stored in session. So that if the user returns the values they selected will persist.
The code I have is a follows:
<br />
int[] intArray = new int[RemapRepeater.Items.Count];<br />
DropDownList reMapDropDown = new DropDownList(); <br />
<br />
for (int i=1; i <= RemapRepeater.Items.Count; i++)<br />
{<br />
reMapDropDown = (DropDownList)RemapRepeater.Controls[i].FindControl("reMapDropDown");<br />
intArray[i] = reMapDropDown.SelectedIndex;<br />
}<br />
However every dropdown returns a selected value of 0, as if it's picking up the values of the page when it was first rendered and not the values that have been selected.
Has anyone any ideas where I might be going wrong?
Regards
Paul Custance
|
|
|
|
|
If your drop down is data bound and you bind to the data source every time, that will reset the selected index. Use !IsPostback to only do it the first time.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
OK, I truly hang my head in shame, how could I miss something so obvious! Think I couldn't see the wood for the trees, so to speak!
Thanks Christian, worked a treat and thanks for such a prompt response
Paul
|
|
|
|
|
Glad to help
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi i have came with this line of coding to displaying data on chart but it doesn't display anything and it doesn't give me an error.what 's wrong with this code.
Chart1.DefaultSeries.ConnectionString = @"Data Source=DAKESERVER;Initial Catalog=Customer;User ID=sa";
Chart1.Series.SqlStatement = "SELECT Name FROM CustomerDetails";
Chart1.SeriesCollection.Add()
Mamphekgo
|
|
|
|
|
No-one knows. There is no chart component build into ASP.NET, so we'd need to know what component you're using, and then we'll probably tell you to ask the people who wrote it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I m having following problem while dedugging the site having gridview.......
Cannot open database "Test" requested by the login. The login failed.
Login failed for user 'PC6\ASPNET'.
|
|
|
|
|
Well, a good place to start might be to make sure that the user has permissions to access the databse, run stored procedures, etc.
|
|
|
|
|
this code keeps coming up on my first page.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC31019: Unable to write to output file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\26676eb7\92c7e946\App_Web_loggedin.aspx.cdcab7d2.1-wj1so1.dll': The directory name is invalid.
What should I do to run the asp.net file on my server?
-- modified at 6:56 Wednesday 22nd August, 2007
BiG RaLpH
|
|
|
|
|
|
Hi all,
I started with an intranet site for our company, so I'm using windows authentication for the site access. I had a look at the configuration tool provided in Visual Studio 2005 and added the roles of administrator, editor and browser.
The idea is that the users will default to browsers role, so they will only be able to view the intranet site, but I want to assign different access levels for the managers of the departments, that is why I have administrator and editor. So the managers of the departments will be able to edit the content of their departments but not of the other departments, and the rest of the department will only have browse capability.
So my question is how do I assign those specific users those roles?
Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Hi friends,
How to refresh panel control in asp.net2.0.I have to refresh only the panel control not the page only panel control........
kirankumar
|
|
|
|
|
You have to add this panel control into ASP.NET Ajax Update Panel.
For more ~ ASP.NET Ajax[^]
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Use Javascript like something below.
Assuming you need to update a button with id "TestButton"
document.getElementById("TestButton").Value = "TestData";
If you require it to be more complex operation you will heva to use the XMLHttp object to retrieve value and use JS to update the control.
Thank you
Laddie
|
|
|
|
|
we want to load images to our web page at the time when we scroll down . because there may be 100-1000
images .so loading all the images all together id inefficient.
thanks
jophin
|
|
|
|
|
Ajax to the rescue. You've to track the page scroll (or control scroll) event and load the picture if the scroll value exceeds a given height.
SG
|
|
|
|
|
Hi,
Hope every one is fine. I am developing a website using ASP.NET 1.1. My site is working fine in Internet Explorer but when i run it on Firefox the alignment of controls changes and site looks deshaped...further more if i run it on NetScape only the login page is displayed and when i login every thing goes blank, no page or control is displayed.
Kindly tell me what is the reason of this problem and how to overcome it? Somebody told me that there is a option in properties of project which enables site to be displayed same on every browser, can any one tell me where is that option?
Thanks in advance,
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
Basically, the different browsers render different CSS differently. You need to work through each issue in your site and find ways to lay it out that work with all browsers. Welcome to hell, sorry.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks for reply,
I hope i am not alone in hell...can you direct me from where to start, i am trying and trying and trying but found no solution. what kind of changes i should make in CSS to make it work on every browser...?
any kind of help is appriciated...
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
How to reorder the columns of a databound gridView in run time
|
|
|
|
|
There is nothing built in to do that, you'd have to do it with javascript. Of course, a gridview is a server side construct, it's just spitting out a table on the client end.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have created a textbox on button click event :
<code>
protected void btnCreateTextBox_Click(object sender, EventArgs e)
{
TextBox txtDynamic = new TextBox();
txtDynamic.ID = "txtDynamic";
pnlContainer.Controls.Add(txtDynamic);
}
</code>
and when the page loads, i click on the button to load the textbox at runtime, it works fine.
The problem in in fetching the value of the textbox when the user clicks on the "save" button.
I am trying this, but it doesnt works. Since after the postback, there is NO existence of the runtime textbox.
<code>
protected void btnSaveTextBox_Click(object sender, EventArgs e)
{
Response.Write(GetDynamicTextValue());
}
private string GetDynamicTextValue()
{
foreach (Control ctrl in pnlContainer.Controls)
{
if (ctrl.GetType() == typeof(TextBox))
{
return ((TextBox)ctrl).Text;
}
}
return string.Empty;
}
</code>
Here is body of my aspx page
<code>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID=btnCreateTextBox runat=server Text=Create OnClick="btnCreateTextBox_Click" />
<asp:Panel ID=pnlContainer runat=server></asp:Panel>
<asp:Button ID=btnSaveTextBox runat=server Text=Save OnClick="btnSaveTextBox_Click" />
</div>
</form>
</body>
I understand the problem is related to page life cycle, but am not being able to resolve it.
Could somebody please explain me the same OR write the "GetDynamicTextValue()" method for me.
Any help/referrence/discussion will be of real help. Am really stucked into an application that needs this utility.
Thanks a lot for reading.
</code>
|
|
|
|
|
Try the following code ~
ArrayList al = new ArrayList ();<br />
protected void Page_Load(object sender, EventArgs e)<br />
{ <br />
if ( !Page.IsPostBack )<br />
{<br />
Cache["myCtls"] = "";<br />
}<br />
else<br />
{<br />
if ( Cache["myCtls"].ToString() != "" )<br />
{<br />
try<br />
{<br />
al = (ArrayList)Cache["myCtls"]; <br />
foreach ( object o in al )<br />
{<br />
if ( o.GetType () == typeof (TextBox) )<br />
{<br />
TextBox txt = (TextBox)o;<br />
<br />
pnlContainer.Controls.Add (txt);<br />
}<br />
}<br />
}<br />
catch ( Exception ex )<br />
{<br />
Console.WriteLine ("Why?? Why? babe!" + ex.Message);<br />
}<br />
}<br />
}<br />
<br />
}<br />
protected void btnCreateTextBox_Click(object sender, EventArgs e)<br />
{<br />
TextBox txtDynamic = new TextBox ();<br />
txtDynamic.ID = "txtDynamic" + al.Count ;<br />
pnlContainer.Controls.Add (txtDynamic);<br />
al.Add(txtDynamic);<br />
Cache["myCtls"] = al;<br />
}<br />
protected void btnSaveTextBox_Click(object sender, EventArgs e)<br />
{<br />
Response.Write (GetDynamicTextValue ());<br />
}<br />
<br />
private string GetDynamicTextValue()<br />
{<br />
string str = string.Empty;<br />
foreach ( object o in al )<br />
{<br />
if ( o.GetType () == typeof (TextBox) )<br />
{<br />
str = str + ((TextBox)o).Text;<br />
}<br />
}<br />
return str;<br />
}
I have tested in my side and it works well...
Hope it helps.....
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Thanks a lot for the reply.
I understand what the code is doing is, its loading the textbox again in each page load so as to keep its existence thru the round trips. The solution is perfectly fine but i didnt wanted that to happen.
I dont want to reload the textbox once the "save" button is clicked.
To be pertinent, I want to know is there a way to "manuallly" catch the values stored in the PostBackData... i know abt _doPostback event, but then how to write a "generic" method which can keep track on the values of a desired control. [ ]
|
|
|
|