Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Tuesday, October 14, 2008

Anonymous impersonation for FBA portals in SharePoint

We all get used to grant IUSER_computername any access we need as IUSER is the internet users that all anonymous user are impersonating when they try to access any page in your portal, and it works for only windows authentication. To do the same thing but with forms based authentication you need to
1- Store or register your IUSER for example guest to your membership repository.2- Grant that guest any access rights you want inside or outside SharePoint.3- Write some code to make all unauthorized users impersonate that guest inside the portal 'Global.asax'. which is protected void Application_AuthenticateRequest(Object sender, EventArgs e) { string cookieName = FormsAuthentication.FormsCookieName; HttpCookie authCookie = Context.Request.Cookies[cookieName]; if (authCookie == null) { FormsAuthentication.SetAuthCookie("guest", false); } }So all the anonymous users will have a guest access 'your created guest' on your portal
For more details see the link below.
http://blogs.devhorizon.com/reza/?p=508

Wednesday, April 16, 2008

How to Perform a Search by Using the SQL WHERE Clause in commerce server 2007

it is really nice but i am still facing problem with it :(

public static CatalogItemsDataSet SearchCatalog(CatalogContext context, string catalogName){ // Search the catalog. // Create the search options. CatalogSearchOptions searchOptions = new CatalogSearchOptions(); searchOptions.PropertiesToReturn = "CategoryName, DefinitionName, i_classtype, ProductId, VariantId, DisplayName"; searchOptions.SetPaging(1, 20); searchOptions.SortProperty = "CategoryName"; CatalogSearch catalogSearch = context.GetCatalogSearch(); // Specify the catalogs to search. // This is a comma-separated list of catalogs to search, // for example, "Catalog1,catalog2". catalogSearch.CatalogNames = catalogName; // Specify the categories to search. All categories that match the // expression are searched. This example searches all categories // that have "technical" as part of their descriptions. catalogSearch.CateoriesClause = @"Description like '%technical%'"; // Return all items with price less than $10.00. catalogSearch.SqlWhereClause = "cy_list_price<10"; // Also use the free-text search. catalogSearch.UseAdvancedFreeTextSearch = true; // Return all rows that contain the phrase "sql books". catalogSearch.AdvancedFreeTextSearchPhrase = "\"sql books\""; catalogSearch.SearchOptions = searchOptions; // Perform the search. int totalRecords = 0; CatalogItemsDataSet catalogItems = catalogSearch.Search(out totalRecords); Console.WriteLine(totalRecords); // Access each of the returned items. foreach (CatalogItemsDataSet.CatalogItem catalogItem in catalogItems.CatalogItems) { Console.WriteLine(catalogItem.CategoryName); Console.WriteLine(catalogItem.DisplayName); } return catalogItems;}
http://blogs.msdn.com/nikhiln/default.aspx
http://blogs.msdn.com/rdonovan/
http://blogs.msdn.com/vinayakt/archive/2004/05/08/128366.aspx
http://msdn2.microsoft.com/en-us/library/aa546103.aspx
http://blogs.msdn.com/vinayakt/archive/2004/05/13/130972.aspx

Paging in commerce server 2007, C# code

CatalogSearchOptions searchOptions = new CatalogSearchOptions();
searchOptions.SetPaging(PageNumber, PageSize);
YourCatalog.GetProducts(searchOptions);//returns a dataset :)


and nice article talks about that below.


http://www.eggheadcafe.com/forumarchives/commerceservercatalog/Nov2005/post24391792.asp