Access Windows Search index using ASP.NET MVC - asp.net-mvc

I'm on a project that is being upgraded from vbscript to ASP.NET MVC. It used Microsoft Index Server to index Word and PDF files on a Windows Server 2003 machine. It simply opened an OleDbConnection using a connection string like "Provider=\"MSIDXS\";Data Source=\"docSearch\";".
After researching a bit, I learned that Index Server is obsolete ("Note Indexing Service is obsolete as of Windows XP. Instead, use Windows Search." - http://msdn.microsoft.com/en-us/library/ms690580) and Windows Search is the successor.
So, in my new MVC app, I'm trying to connect using OleDbConnection with a connection string like "Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"".
I have a method that takes in a formatted query and executes the search - here is the query that gets executed using OleDb:
string.Format("SELECT System.FileName FROM SystemIndex WHERE CONTAINS('{0}')", query)
Now, when I call my method in a test class, it works fine (i.e. returns results... myDataReader.HasRows is true). But, when I call the same method from my MVC Controller, it returns no results - myDataReader.HasRows is false - using the same query. My guess is something to do with permissions and IIS not being able to access the index. How can I get IIS to have access to the index? How can I expose the index to a ASP.NET web page? If Index Server is obsolete, and this functionality isn't supported in Windows Search, what am I supposed to use?

I would not change just because it is not supported unless you are having a specific problem with Indexing Service or need a feature from the newer version.
I would get connection string from ISearchQueryHelper
Does the service have the correct permissions? Have you checked the Windows Search 3.0/4.0 SDK?
I see you are on the forum (http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchdevelopment/thread/7b9eead4-d938-42c6-ba2b-2c238a7706f9)
I am not sure Windows Search can really replace Indexing Service for Web sites. For instance, there is only one index called "SystemIndex" which contains everything on the local system. Therefore, how would you limit the results to just a Web site?
I believe you need to use "enterprise search" or "search server", which I have no experience with.
Since the results for both Indexing Service and Windows Search are ADO.NET, the presentation does not change much. The API is different enough that you will need to make many changes. For instance, there is no "scope" in Windows Search. When I changed over my personal "desktop search" application, it took an hour to make the change, but two days to duplicate all the functionality that I had with Indexing Service because of the API changes. I made this change because Windows Search is better when searching for code snippets in my "Code Library"
For standard queries with no regular-expressions or wild-cards or non-standard properties, both perform the same. Indexing Service always retrieves data quicker, but may not perform some queries that are "too expensive". Windows Search can take a long time retrieving the data depending on the query. Typically, these "long queries" are the "too expensive" queries of Indexing Service. "Long queries" can also result from any query that retrieves a property that is not contained in the index.
I am still using Indexing Service for my web sites on Windows Server 2003 and do not plan to make any changes because it is not as easy as I expected and there is no compelling reason to do.

I found my answer here ASP.NET OLEDB code breaks when deployed on IIS7. By impersonating a user that has access to the index.

Related

Mvc.Net show many results from web service

I have an mvc 4.0 system that uses other system's web api service. The problem is that sometimes the service returns ~11,000 records, and the web page gets stuck and unable to show all of them.
How can I solve this problem? If the data was stored in my database, I would try to implement paging, but that's not the case.

Concurrent access to Neo4j from desktop apps

I am planning to create a desktop app (Java or C# WPF) which would be used by multiple users. The requirements are such that a Graph DB like Neo4j fits perfectly into the scheme of things. I have done some investigations and it looks really good. I am working on the community edition. Now here is the problem. From what I have observed, I am able to make only one connection to the database. The moment I try to make a connection from another instance I get an error. Even accessing on localhost:7474 gives an error.
Is this by design? I understand that in a web App, I can still use a static reference to a single DB instance and work with it. But in a desktop app scenario how do I ensure that multiple users are able to access the database from their apps?
Your app instances can access the same neo4j server through its REST API. There is no need to directly connect to the DB.
Here is a page that shows you how to do that in Java.

Power Query Windows authentication with Odata feed

I am currently trying to find a way for a customer to connect with Power Query (plugin for Excel) to access their published Odata-feed (which is hosted by Microsoft NAV 2013 R2).
For security reasons the NAV server is set to only accept Windows as an credential type. This means that the current user credentials on the client is passed on to the webservice.
The problem: The users of the system is often off site and working on another domain with a VPN connection to the NAV-environment. With that said Power Query does not pass the "correct" AD-information to the published Odata-feed which means that the user is not authorized.
I am looking for a way to change which AD-credentials that are sent thru Power Query and then to the Odata webservice.
The users have no problem typing in the webservice adress in a web browser and type in the Windows credentials when prompted and access the feed. But in Power Query there is no option for typing in custom Windows Credentials when refreshing the data.
I've tried with WebAPIKey and Basic authentication. But since the NAV-server/Webservice is set to only accept Windows authentication I'm in the dark..
Any thoughts?
I got this answer from Curt Hagenlocher (Moderator on Technet)
I'm afraid this isn't something we currently support, though we have
considered implementing it. We do loosely track feature requests and
use them to prioritize future work.
(https://social.technet.microsoft.com/Forums/en-US/03c529ba-5f20-4bc1-84de-35cc91e7c1a6/power-query-custom-windows-credentials-authentication-with-odata-feeds?forum=powerquery)

How to access start addresses of a Content Source programatically?

How can we get a list of start addresses added in a Sharepoint content source programatically ? The code which need to achieve this will be running on different server than where sharepoint is installed so i am looking for a solution where we can query sharepoint database to get this list.
Never query the sharepoint database directly. Even a simple select statement an cause a read lock, potentially creating havoc in your farm.
By using the database directly you are NO LONGER SUPPORTED, meaning that if it does go belly up and you call microsoft for support, they'll send someone from consulting ($$$$) or ask you to go back to the last known good configuration (i.e. a backup of your sharepoint databases from before the point you started accessing the database directly...)
Create a web service that uses the sharepoint object model to get this list, then deploy it to the sharepoint machine, then have your external app use that service.

Suggestions for a practical User Authentication System?

I hate to re-invent the wheel so I'm looking for an existing solution to create a simple authentication system for my application. I've experimented for a while with using CardSpace or OpenID inside the application but I can't convince management that these would be working solutions.
Of course, I could just build a simple login dialog where username, domain and (hashed) password is stored inside a database table and I've done such a thing many times already. I hate this solution since I feel it's just a weak option. And I don't want to spend too much time trying to make the whole logon system as secure as possible, especially since I suspect that there should be existing solutions for this.
So, next to OpenID/OpenAuth and CardSpace, are there any other Authentication solutions that can be used from a Delphi/WIN32 application?
Right now, the application will be used by many customers. Most are single-user environments, although it's likely that some of those will start to have two to 5 users once this authentication system is added. But we want to support a customer who needs to allow about 500 different users on the same application. These are spread over about 100 offices but they all connect to the same SQL Server database. (MS Access right now, but we're making it possible for this user to use SQL Server instead.) To make matters even more interesting, the customer uses Citrix to centralize the user systems and the application has straight access to the SQL Server database. It's not an ideal setup but then again, the customer isn't really paying for this. We're just setting up a test environment. A proof-of-concept which the customer will test for us. Flaws will be solved later on. But right now I need quick solutions and one of them is a practical authentication system where I don't have to write a lot of code.
Have you considered using SQL Server authentication and not allowing authentication for those using an Access Database?
If you use the new SQL Server Native Client and SQL Server 2005 you can have passwords expire and change them from your client application. All of the tools to create and manage user accounts are built into SQL Server Management Studio. And if you decide later to support Windows Authentication you just need to modify your connection string.
We have a system where users on the network use Windows Authentication so they don't need to worry about another user name and password. For users that access the system via a VPN and non-domain joined machines they use SQL Authentication.
Here is the MSDN Page that talks about dealing with passwords programmatically in SQL Server 2005
You do need to make sure that SQL Server Native Client is installed, but that is simple compared to the rest of ADO.
I would suggest then
Delphi - since you are using Delphi :)
Open source - since you need to be able to figure out what is wrong if there is a problem, you probably want it cheap.
So, here are some solutions:
http://www.torry.net/pages.php?id=313
CoWindowsAccount v.1.0
SSecurity v.1.2.1.3
http://free-password-manager-plus.software.informer.com/1.6/
It might work for your purposes, but why not ask Windows for the current domain and user name, and use them as unique IDs. Windows has already done the authentication, and it saves the users making up new passwords or anything. I've used this to good effect. I also made it optional to include the machine name in the ID, so that the same user on different computers would also be unique.

Resources