Role-based intranet search - asp.net

I'm currently working on an ASP.NET 3.5 intranet that uses role-based security, both on the page level and the page content level in some cases. I'd like to implement a site-wide search, but restrict results according to what the current user would normally see when they visit a given page. I suppose it would have to index the site separately for each user?
I've searched the ASP.NET community control gallery as well as Google, and have not found anything that can index in such a specific way. Can anyone offer a link to a pre-built control/solution that will handle this scenario, or a custom technique that I could try?
Thanks.

Basically, for each URL you retrieve you could have extra attributes to map the user to the resource as follows:
<a href="~/somepage.aspx" id="someLink" RoleAuth="xxx" RoleArgs="yyy" runat="server" />
Then you could use a Web Part, control, etc., to display each result link based on the user's logged-in credentials :-)

If you store somewhere that what content is accessible to what roles then it is only matter of another join in your query.
Another but expensive option is to get the search results and then filter them based on the accessibility of requesting user.

Related

How to add a bespoke social sharing message to a specific page

I've used services like 'Add This' for a while but now I need to add a couple of specific bits of functionality to an ecommerce order completion page. It's to work like Amazon's order thank you page where it allows you to post a message to Facebook saying something like 'I just bought a widget on Amazon'.
Equally I'm looking for the equivalent in Twitter.
I've added a bunch of OG tags and share buttons but can't get it to do what I need. From further reading it sounds like I might need to create a Facebook app of some sort and use FB ui to create the link to post to the user's wall. I was hoping to do this without getting tangled up in that level of permissions etc but maybe that's not possible any more?
This is being developed on asp.net C#, in case there's a library that I haven't found in my searching.
Can anyone familiar with this type of development point me in the right direction?
For Twitter, the simplest way is to use Web Intents.
For example, if you want to share the text
I love http://example.com
URL encode the text to I%20love%20http%3A%2F%2Fexample.com and use the Twitter Web Intent URI. E.g.
https://twitter.com/intent/tweet?text=I%20love%20http%3A%2F%2Fexample.com
When the user clicks on that link (try it!) or is directed there by your service, they'll be prompted to share that text.

How do I allow users to display LinkedIn profiles on my site?

I have a site (using PHP and JavaScript with jQuery) which allows users to display a profile, and I would like them to have the option of simply importing their LinkedIn profile, if they have one, rather than having to type everything in again.
I'm not sure what the best approach is here... I've read some of the LinkedIn API documentation, but I'm not even really sure which bit I need to look at.
The process should be:
User goes to profile management page
User is shown a checkbox saying "use my LinkedIn profile", and a textarea. If they don't want to type their profile into the checkbox, they check the checkbox, and somehow their Linked In profile is retrieved.
The LinkedIn profile is stored (or some kind of id is stored), so that the profile can be retrieved by anyone else at any time.
I'm not very familiar with the LinkedIn API, or with the site itself, so I'm not even sure what's possible. Does this sound possible, and if so, where do I start?
You can start with the User Profile tutorial here:
http://developer.linkedinlabs.com/tutorials/jsapi_profile/
The example uses jquery so it should be pretty easy for you to extend this to do what you want.

How to use ASP.NET Routing in a Quote of the Day Website

Good Afternoon,
A client is interested in creating an ASP.NET 2.0 website whose purpose is to serve up a "quote of the day". He wants the quotes on static content pages all attached to the same master page. The quote pages must be viewed in a certain sequence, and site browsers cannot view any other pages than the starting page when browsing to the site. That is, everyone must go to page 001.aspx when entering the site.
Two Questions:
1. The content pages are going to be created by the client using an excel data source and a merge process by which each quote page is created eg. 001.aspx, 002.aspx etc. This seems clunky to me at best. Would ASP.NET Dynamic Data be a better solution here?
I'm new to ASP.NET Routing and URL Rewriting as a whole. How would I setup a route table to ensure that users always entered the site on the same entry page, and create a route table such that default.aspx resolves to 001.aspx?
Thanks,
Sid
I would suggest to use the excel sheet as a data source and handle viewing the 'Quote pages' by paging through the result set obtained from said data source.
If your client is concerned about SEO, he must recognize that his requirement to have only one entry page defeats his One-Quote-One-Page-Is-SEO-friendly.
I don't think the effort to distinguish between a human user and a search bot is worth it.
Anyway googlebot is capable of indexing pages with URL parameters thus allowing to be SEO friendly without generating static content (other bots should be as well).
Possible solution
To allow search bots to index your Quotes you have a query parameter for the date of the Quote.
If you want to enforce human users (hackers don't count ;-)) to enter the site only by the current date you check the browser string and redirect any browser not being know as a search bot to the current date if the referer is not equal to the previous date.
This solution should give you a reasonable result without too much overhead.

Fill fields on website

I am opening up a web page from a link button.
My issue is populating this web page with data that I need to be pre-populated in some of the fields on that web page.
Can anyone please assist?
Many thanks in advance
Because this involves cross-domain posting of data, you are limited in the approaches that you can take.
If you can guarantee that this will only be small amounts of data, you could pass it in the QueryString. Another alternative is on the click event of the linkbutton, save the data to disk or a database, and pass a reference in the QueryString. This reference might be a filepath if the sites are hosted together or a table id if the sites have access to the same database.
Neither of these approches are ideal. You should provide more information such as how the domains are related if at all and whether they can be hosted in the same App Pool. Do you control the code for both sites?
Perhaps you are asking how to pass variables via the query string:
http://www.aspnet101.com/2007/07/querystring-results-and-sql-statements/
http://www.codeproject.com/KB/aspnet/QueryString.aspx
That is a very useful skill. Then you can create hyper-links (you "link buttons") with query string variables in them:
http://www.informit.com/articles/article.aspx?p=28493&seqNum=3
Based on the requirements that you have stated in the comments on other answers, you cannot set the form fields on the 3rd party site unless you create some sort of browser addin. If this for an in-house purpose, that you would not need the general public to use, you could create firefox or chrome addin to do this. The addin could read the values off the page the link button is on and then apply them to the following page. You may be able to create a greasemonkey script to do this too.

Add-ons or libraries for adding user comment functionality to an existing ASP.NET page?

I have an ASP.NET site which I'd like to add page-level comments to without having to change everything over to a blog/CMS platform like BlogEngine.net, Wordpress, Umbraco, etc. Does anyone know of an add-on or library, either free or for-purchase, which can be added to certain ASPX pages to enable a stream of user comments at the end of the page?
The rest of the ASPX page needs to be able to have ASP.NET form controls, jquery and in some cases postback functionality I've written specific to the page which is why a simple blogging page is not enough as it means the blog engine owns the page aside from static content the site owner can enter.
Ideally there would be a way I could add a code snippet or user control to each ASPX page where I wanted comments and then they would show up and be managed independently on each page. I'd like to have the ability for users who post comments to be emailed when additional comments or replies are posted to their comment.
I am currently not locked into a particular authentication method so that is not necessarily a limiting factor.
This seems fun, I've not used it yet so I can't say if it works well or not.
http://developers.facebook.com/news.php?blog=1&story=198

Resources