|
Hi, I need to validate users throug active directory in asp.net 2.0.
The users will be on diferents locations and dommains. The users aer part of differents companies with differents dommains, so for a single user I need to search the company at database and load the company settings to be able to do the authentication by active directory.
Is that possible?
Which active directory settings do I need to store for each company?
How can I do that validation?
I have the following snippept:
1. public bool AuthenticateUser(string domain, string username, string
2. password)
3. {
4. string domainAndUsername = domain + @"\" + username;
5. DirectoryEntry entry = new DirectoryEntry( LDAPPATH,
6. domainAndUsername,
7. password);
8. try
9. {
10. // Bind to the native AdsObject to force authentication.
11. Object obj = entry.NativeObject;
12. DirectorySearcher search = new DirectorySearcher(entry);
13. search.Filter = "(SAMAccountName=" + username + ")";
14. search.PropertiesToLoad.Add("cn");
15. SearchResult result = search.FindOne();
16. if(null == result)
17. {
18. return false;
19. }
20. // Update the new path to the user in the directory
21. LDAPPATH = result.Path;
22. }
23. catch (Exception ex)
24. {
25. throw new Exception("Error authenticating user.” + ex.Message);
26. }
27. return true;
28. }
Is the code I need? can you explain me how to contruct LDAPPATH?
Thank you I'm very newie with AD.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
|
Thank you very much.
The links are very very useful.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Hello,
I have a Web.sitemap file. I created a SiteMapDataSource.
Every node on my Web.Sitemap have a property named Visible which is set to true or false.
I need my SiteMapDataSource to get only the nodes from Web.Sitemap which has the property Visible="True".
How can I do this?
Thanks,
Miguel
|
|
|
|
|
It looks like you have already asked this question and someone answered.
|
|
|
|
|
Hello,
In my Web.Config file I created the following:
<sitemap
defaultprovider="XmlSiteMapProvider">
<providers>
<add
name="MyWebSite_SiteMapProvider"
="" sitemapfile="~/Web.sitemap" type="System.Web.XmlSiteMapProvider">
How can I use this SiteMap provider in my page's VB.Net code?
Thanks,
Miguel
|
|
|
|
|
You will use it like this:
MySiteMapDataSource.Provider = SiteMap.Providers("ProviderName")
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
|
|
|
|
|
Hello,
i' am working on a web-application, in asp,using c#.I have a page which demonstrates some search results in a detailsview(with more than one pages) and i want to export it to excell.I 've tried some methods but nothing happens.
It's very important
Thanks............
galatia
|
|
|
|
|
I'm trying to port an HTML Media Gallery to ASP.Net and things were moving right along until I hit the bump of wondering how to call this code from the Click Event of an ImageButton so that I can open the full size image in a pop-up window.
JavaScript:popUp('gallery/ViewTarget.aspx?Element=photos/photo1.gif&Description=A photo.')"><img height="81" alt="A photo." width="108" border="0" src="/gallery/photos/photo1.gif"
The above code was originally in an <href> tag and it worked fine. Can I do something similar in an ImageButton's click event?
<div class='ForumSig'></div>
|
|
|
|
|
Assign the javascript using the OnClientClick property
only two letters away from being an asset
|
|
|
|
|
|
Does anyone know of any examples of custom Members ships with a Sql database that is not created through the asp.net configuration? If so please help.
|
|
|
|
|
|
Hi,
I need urgent help for the situation iam facing. Appreciate any help.
The situation is very similar to what is achieved on this codeproject site. When someone tries to download some code sample or zip file without logging in it redirects the user to login first.
I also need to restrict access to image files, so if a user tries to access image file by entering the url, it should send to login page.
Since the images are opened individually, i am not opening them in any browser, so cannot write authentication code. Basically the images can be accessed directly by entering path. How to restrict it unless user is logged in?
Thanks,
stanwar.
|
|
|
|
|
May be i am not get your question perfectly
but u can use ---
Querrt string. When any user click for url that page is automatically generate some extra code like username and some thing else that will decode at server side.
Also u can think about session object too. Some times it come hendy too..
Viral
|
|
|
|
|
|
Thanks for the replies.
Yet I think my question wasn't clear. The directory I need to protect contains pdf files/images, which should be available to logged in users only. And pdf/images in a website can be directly accessed from url. How to restrict their access?
|
|
|
|
|
Sir,
I have to make a liberary management project .Can u please send any link for the project.
Thanks
|
|
|
|
|
go to this url http://www.vbcode.com/
then search for "library" before hitting search button make sure drop down lost says Exact Phrase
you will find lots of samples
|
|
|
|
|
Hi,
Im using an SQLDataSource to get data from an SQL DB. The DataBind is set to occur at Page_Load. In the code behind i need to capture the data as variables. The data returned is for just 1 record, and is set up via the DataSource wizard in VS2005.
How do i get this data into the variable?
At present i'm trying the following code in the Page_Load event:
<code>staffEmail = DataBinder.Eval(Container.DataItem, "staff_Email").ToString();</code>
However this says 'Container' does not exist in the current context. So how do i retrieve this information??
Any help would be appreciated.
Thanks.
|
|
|
|
|
U can use
Eval("staff_Email") directly no need to do DataBinder.Eval
May be it Possible that .net 2.0 is not support Container code. also u dont have to mention tostring() in behind..
Viral....
|
|
|
|
|
I tried that and got the following error:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Any other suggestions?
|
|
|
|
|
Sorry to reply u late...
Ya you are right it is not going to work. but you can do one thing ---
U can use page_load event of page and write the code some thing like this
=============================================
TextBox1.Text=Ds.Tables[0].Rows[0].ItemArray[1].ToString();
=============================================
it will work and do as you like
it just take little but can helpful.
you just have to creat a dataset or even datatable or even datarow as u like and will work perfact
Viral
|
|
|
|
|
I have two textboxes and want this comparevalidator to do a case insensitive comparision.... is there any workaround?
Thanks in advance
|
|
|
|
|