C# - Custom Providers Using XML As Their Data Store - Should Use XPath / XSLT Or DOM?

Jan 31, 2010

I'd like to learn how to create custom providers ( say custom membership provider or custom profiles ) that use XML as their data store. Is ( using C# ) best way to accomplish this using XPath/XSLT or DOM?

View 1 Replies


Similar Messages:

JQuery :: How To Use Jquery In Xslt That Fill A Combo Box ,also Require Xml ,xslt ,xpath Editior

Dec 29, 2010

[Code]....


View 2 Replies

MVC :: How To Implement Custom Authentication And Personalization Providers

Mar 24, 2010

i am in the process of developing an asp.net mvc 2 social web app and some of the requirements have to do with users authentication and personalization. Site visitors should be able to login using credentials not only by registering to my site but also by entering external account credentials (Live ID, facebook, etc...). Also, users should have a custom profile, where they could enter personal details, preferences, etc...

Is there any good tutorial on how to implement custom membership and profile providers? The default Role provider that comes with asp.net mvc is ok and does not need to be re-implemented.

View 5 Replies

WCF - Compatibility Mode And Custom Authentication Using Membership Providers

Oct 26, 2010

To begin with I work on the large application, that has a WinForms client and server. Server in our case is the set of WCF services. There is one service that is responsible for authentication of users. The logic of authentication is custom and complex and authentication service uses different membership providers.

We want to protect the access to server services for non-authenticated users. The users must firstly authenticate and than use other services (users in this case are the other systems, services, WinForms client, etc.). On this basis, we decided to use the ASP.NET Url/File Authorization feature.

So, I set on the ASP.NET compatibility mode, allowed cookie in all binding configurations, added AspNetCompatibilityRequirements attribute to our services and added the followingconfigurations to config:

<authentication mode="Forms">
<forms cookieless="UseCookies">
<credentials passwordFormat="Clear" />
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
...
<location path="AuthenticationService.svc">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>

In the authenticate method of our authentication service I add the following code:
public AuthenticationResult AuthenticateUser(string username, string password)
{
AuthenticationResult result = new AuthenticationResult();
result = Authenticate(username, password);
if (result.IsAuthenticated)
FormsAuthentication.SetAuthCookie(username, true);
return result;
}

Next, I wrote the following code:

var authClient = new AuthenticationServiceClient();
var result = authClient.AuthenticateUser("user", "password");
var otherClient = new OtherServiceClient();
var temp = otherClient.DoSomething();

But after authentication I can't access to OtherServiceClient...

So, how can I share the call context between the WCF services calls? Could anybody provide some useful articles about this question?

View 1 Replies

Configuration :: Deploying Custom Membership And Role Providers Under IIS7

Jul 27, 2010

I have a custom membership provider and a custom role provider in a .NET assembly dll called Qws.Web. The full namespace path to the classes are Qws.Web.Providers.QwsMembershipProvider and Qws.Web.Providers.QwsRoleProvider They both inherit MembershipProvider and RoleProvider respectively When I include the assembly using a project reference in VS2010 it all works fine. The minute I publish the website and project to the staging server (using IIS7) i get the following error: Unable to find the requested .Net Framework Data Provider. It may not be installed. You can see the site at [URL] I've tried all of the usual stuff and been trawling the internet for the last two days.

1. The Qws.Web.dll file IS in the bin folder
2. My Web.Config file is below:

[Code]....

3. The providers are not in the GAC and not in the machine.config file as I only want them available for this site.

View 3 Replies

C# - Forms Authentication Code-Behind With Custom Role And Membership Providers

Mar 8, 2011

Unfortunately, all the examples for Forms Authentication Code Behind w/ Custom Role and Membership Providers I find online are written with a VB.NET code behind and I need a C# code behind. I need a codebehind that will do the following:

authenticate user upon login button click
if user active_flag=0 (false) OR password!=@password, display error: "Access Denied"
if user admin_flag=1 & active flag=1 (true), redirect to admin_pageszipsearch.aspx
if user admin_flag=0 (false) & active_flag=1 (true), redirect to pageszipsearch.aspx

Default.aspx Code:

<asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">
<LayoutTemplate>
<span class="failureNotification">
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
</span>......

View 1 Replies

Get The ISP Providers Or Webhosting Providers Name For A Domain?

Nov 15, 2010

I want to know the name of the ISP provider and webhosting provider name for given Domain.

is it possible to know the ISPs name and webhosting providers name through Dotnet or manulally?

View 1 Replies

How To Store Custom Data In Membership Cookie

Jul 14, 2010

give me an example (or point me in the right direction) on how to store custom data in an ASP.NET Membership cookie? I need to add some custom properties like UserID and URLSlug to the cookie and be able to retrieve the information in the same way one would retrieve the Username.

Edit:

I used Code Poet's example and came up with the following.

When I set a breakpoint at Dim SerializedUser As String = SerializeUser(userData) the value of userData is right. It has all the properties I expect it to have.

The problem I'm now running into is that when I get to Dim userdata As String = authTicket.UserData (breakpoint), the value is "". I'd love to figure out what I'm doing wrong.

Here's the code.

Imports System
Imports System.Web
Imports System.Web.Security
Namespace Utilities.Authentication
Public NotInheritable Class CustomAuthentication
Private Sub New()
End Sub
Public Shared Function CreateAuthCookie(ByVal userName As String, ByVal userData As Domain.Models.UserSessionModel, ByVal persistent As Boolean) As HttpCookie
Dim issued As DateTime = DateTime.Now
''# formsAuth does not expose timeout!? have to hack around the
''# spoiled parts and keep moving..
Dim fooCookie As HttpCookie = FormsAuthentication.GetAuthCookie("foo", True)
Dim formsTimeout As Integer = Convert.ToInt32((fooCookie.Expires - DateTime.Now).TotalMinutes)
Dim expiration As DateTime = DateTime.Now.AddMinutes(formsTimeout)
Dim cookiePath As String = FormsAuthentication.FormsCookiePath
Dim SerializedUser As String = SerializeUser(userData)
Dim ticket = New FormsAuthenticationTicket(0, userName, issued, expiration, True, SerializedUser, cookiePath)
Return CreateAuthCookie(ticket, expiration, persistent)
End Function
Public Shared Function CreateAuthCookie(ByVal ticket As FormsAuthenticationTicket, ByVal expiration As DateTime, ByVal persistent As Boolean) As HttpCookie
Dim creamyFilling As String = FormsAuthentication.Encrypt(ticket)
Dim cookie = New HttpCookie(FormsAuthentication.FormsCookieName, creamyFilling) With { _
.Domain = FormsAuthentication.CookieDomain, _
.Path = FormsAuthentication.FormsCookiePath _
}
If persistent Then
cookie.Expires = expiration
End If
Return cookie
End Function
Public Shared Function RetrieveAuthUser() As Domain.Models.UserSessionModel
Dim cookieName As String = FormsAuthentication.FormsCookieName
Dim authCookie As HttpCookie = HttpContext.Current.Request.Cookies(cookieName)
Dim authTicket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(authCookie.Value)
Dim userdata As String = authTicket.UserData
Dim usersessionmodel As New Domain.Models.UserSessionModel
usersessionmodel = DeserializeUser(userdata)
Return usersessionmodel
End Function
Private Shared Function SerializeUser(ByVal usersessionmodel As Domain.Models.UserSessionModel) As String
Dim bf As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
Dim mem As New IO.MemoryStream
bf.Serialize(mem, usersessionmodel)
Return Convert.ToBase64String(mem.ToArray())
End Function
Private Shared Function DeserializeUser(ByVal serializedusersessionmodel As String) As Domain.Models.UserSessionModel
Dim bf As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
Dim mem As New IO.MemoryStream(Convert.FromBase64String(serializedusersessionmodel))
Return DirectCast(bf.Deserialize(mem), Domain.Models.UserSessionModel)
End Function
End Class
End Namespace
Here's where I create all the magic. This method is in a "BaseController" class that inherits System.Web.Mvc.Controller
Protected Overrides Function CreateActionInvoker() As System.Web.Mvc.IActionInvoker
If User.Identity.IsAuthenticated Then ''# this if statement will eventually also check to make sure that the cookie actually exists.
Dim sessionuser As Domain.Models.UserSessionModel = New Domain.Models.UserSessionModel(OpenIdService.GetOpenId(HttpContext.User.Identity.Name).User)
HttpContext.Response.Cookies.Add(UrbanNow.Core.Utilities.Authentication.CustomAuthentication.CreateAuthCookie(HttpContext.User.Identity.Name, sessionuser, True))
End If
End Function
And here's how I try and retrieve the info.
Dim user As Domain.Models.UserSessionModel = CustomAuthentication.RetrieveAuthUser

View 2 Replies

How To Retrieve XML Data Using XPath Expression

Oct 19, 2010

I have a XMLDataSource somewhat like:

<bookstore>
<author>author1</author>
<publication>publication1</publication>
<book>
<genre>Thriller</genre>
<name>ABC</name>
</book>
<book>
<genre>Romance</genre>
<name>XYZ</name>
</book>
<book>
<genre>Horror</genre>
<name>000</name>
</book>
</bookstore>

I am storing these in a asp:formview. I am able to store author and publication values but not sure how can I store the value of book/name based on some condition? Actually I just want to use condition that I need to store the value of "name" if "genere=Romance". something like this. I tried using XPath expression bookstore/book/genre[. ='Romance'] but not sure how to access the value of tag. Checked the following resource:

[URL]

View 2 Replies

Forms Data Controls :: How To Use Xpath In HeaderTemplate

Jun 8, 2010

I am trying to bind xml to GridView.

I am not able to use Xpath in HeaderTemplate like <HeaderTemplate>'<%#XPath("Name")%>'</HeaderTemplate>

Error: Value cannot be Null.

Well, how to I insert my Xpath value into HeaderTemplate from Serverside?

View 6 Replies

Forms Data Controls :: How To Create Gridview In Code Behind Using Xpath

Mar 15, 2011

how to create a gridview template

with text box

From
To
Company
Profile

[Code]....

FromToCompanyProfile

[Code]....

xml File

[Code]....

View 1 Replies

Forms Data Controls :: XPath With Dynamic Variable And Similar To SQL's Between?

Jun 15, 2010

I think I am struggling with something that may not be entirely relevant to XPath, but this is the function I am trying to use. I have a code snippet here that works,

[Code]....

It prints out: Items for page 1 is: 1 to 10. What have I missed here regarding this issue?

View 4 Replies

Forms Data Controls :: Eval(), XPath(), And Bind() Can Only Be Used In The Context Of A Databound Control?

Mar 9, 2010

I have a big problem...I have made a page has a Data FormView controland the insert template of this Formview control has DropDownList to allow the user to choose section (SectionsDDList)..and there's also another DropDownList allow the user to choose a teacher (TeachersDDList)...more infothe SectionsDDList get the section list from SqlDataSource control which the "Select Command" of is:"SELECT section_id,section_id FROM sections"the TeachersDDList get the teachers list from another SqlDataSource control which the "Select Command" of is:"SELECT teacher_id,teacher_name FROM teachers WHERE (section_id = @section_id)"finallyI want the TeachersDDList to be filled with teachers according to the selected section from the SectionsDDList...So,I enable the Auto postBack function of the SectionsDDListand add the next code for the SectionsDDList_SelectedIndexChanged event:TeachersDataSource.SelectParameters["section_id"].DefaultValue = ((DropDownList)sender).SelectedValue;be aware that both of the SectionsDDList & TeachersDDList have been Bounding to a column...and the problem I have faced is that:Exception Details: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.maybe you want to know the Stack Trace:[InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.]

System.Web.UI.Page.GetDataItem() +93
System.Web.UI.TemplateControl.Eval(String expression) +33
ASP.cpanel_managecourses_aspx.__DataBinding__control82(Object sender, EventArgs e) in

[code]...

View 8 Replies

Reading Data From .XSLT File Populate Dropdown?

Feb 8, 2010

I would like to read some data from a .XSLT file to populate my dropdown, the outline is as follows

file name StaffDirectory.xslt

<xsl:stylesheet version="1.0" extension-element-prefixes="msxsl" exclude-result-prefixes="msxsl js dl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:js="urn:custom-javascript" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:dl="urn:datalist">

[Code].....

So id like to retrieve all values for ="IDAKRS0J" and populate a dropdown with this, is this possible ?

View 1 Replies

Asp.net -safe To Store In Custom IIdentity?

Jul 8, 2010

I have created a custom Iidentity object to store specific user settings for logged in users. I was wondering is it safe to store sensitive data like userid's or other id's in the object? Is there any security risk to doing so? Also, how much is too much to store in the object?

View 1 Replies

Web Forms :: Display The Hierarchial Data In A Tree View From The DataSet. Using XML And XSLT?

May 27, 2010

i want to display the hierarchial data in a tree View from the DataSet. using XML and XSLT how can i achive this?

View 3 Replies

Custom CreateUser Method With Additional Parameters - Store In The Db

Mar 5, 2010

i have implemented custom MembershipProvider and now i would like to use CreateUserWizard to create new users.. the problem is that i want to store in the db more information that normally (e.g. first and last name). There is function:

public override MembershipUser CreateUser(string username, string password, string email,
string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey,
out MembershipCreateStatus status)
{
throw new NotImplementedException();
}

which i can implement but it won't store first name etc. i found here: [URL] solution that i can overload this function and call it manually but the default CreateUser function will still be called in this case...

View 1 Replies

.net - Use Custom SqlMembershipProvider To Store Users (and Roles) In Cache?

Feb 15, 2011

i'm developing a "small" warehouse-management WebApplication for few users(5-10 parralel) but with a complex authorization system(checking if pages,menus,TabPanels, UserControls and even single controls are visible or enabled) and permanent and frequent access. Because i've only limited experiences with the ASP.Net MembershipProvider, i'm unsure what's the best approach for following goal:

I want to hold all users, roles and frequently used masterdata in the Cache(in a Dataset). Hence every readonly access should be faster and causes less traffic than always using the database. On updates,deletes and inserts i would update the cached dataset and also the database.Can i use or extend the SqlMembershipProvider to achieve this goal and if possible how?Should i use the stored-procedures from asp.net or simply use the standard CreateUser, GetUser, DeleteUser-functionality? Does this approach makes sense at all?

View 1 Replies

Create Custom Class To Store Shopping Cart Items?

Mar 8, 2011

I have created a shopping cart where i currently store items in a session but i want to get away from this.

so i am going to store it in a list.

how can i create a custom class for this and store the values everytime items are added.

View 2 Replies

Web Forms :: How To Store Multiple Entries Of Properties On Custom Object In C#

Jan 12, 2010

I am creating a web service that returns the list of states. How do I create an object in C# in the web service that will return multiple values (of properties of an object). Currently, the way I am doing it, it only returns the last value pulled from the database. Do I need store an array of properties?

[code]....

View 5 Replies

Custom Class To Store The Properties And To Pass Its Instance Across The Pages

May 12, 2010

I've a requirement where i need to pass some objects across the pages. So i created a custom class with all the properties required and created a instance of it and assigned all the properties appropriately. I then put that object in the session and took it the other page. The problem is that even when i set the properties values to the class it is coming as null. I set a breakpoint in the getter-setter and saw that the value itself is coming as null.

public class GetDataSetForReports
{
private Table m_aspTable;
private int m_reportID;
private string m_accountKey;
private string m_siteKey;
private string m_imUserName;
/// <summary>
/// Asp Table containing the filters
/// </summary>
public Table aspTable
{
get
{
return m_aspTable;
}
set
{
m_aspTable = aspTable;
}
}
/// <summary>
/// Report ID
/// </summary>
public int reportID
{
get
{
return m_reportID;
}
set
{
m_reportID = reportID;
}
}
/// <summary>
/// All the accounts selected
/// </summary>
public string accountKey
{
get
{
return m_accountKey;
}
set
{
m_accountKey = accountKey;
}
}
/// <summary>
/// All the sites selected
/// </summary>
public string siteKey
{
get
{
return m_siteKey;
}
set
{
m_siteKey = siteKey;
}
}
/// <summary>
/// Current User Name
/// </summary>
public string imUserName
{
get
{
return m_imUserName;
}
set
{
m_imUserName = imUserName;
}
}
}

This is how i'm creating an instance in the page1 and trying to get it in the page2. Page1 Code

//Add the objects to the GetDataSetForReports Class
GetDataSetForReports oGetDSForReports = new GetDataSetForReports();
oGetDSForReports.aspTable = aspTable;
oGetDSForReports.reportID = iReportID;
oGetDSForReports.accountKey = AccountKey;
oGetDSForReports.siteKey = Sitekey;
oGetDSForReports.imUserName = this.imUserName.ToString();

But the values are not getting set at all. The values are not passing to the class (to the setter) at all. Am i making any OOP blunder?

View 1 Replies

DataSource Controls :: Connect To Different Data Providers (Oracle And SQL Server) Using Single Connection String?

Jun 29, 2010

How to connect to different data providers(Say Oracle and SQL Server) using single connection string?

View 1 Replies

C# - How To Use XPath To Link My XML Document

Mar 4, 2011

Do I have to use XPath to link my XML document to a repeater or is there another way. here is my some of my code.

first page loop through data and store as XML:

public virtual void Button_Click(object sender, EventArgs args)
{
TableControl recControls = (TableControl)this.Page.FindControlRecursively("TableControl");
if (recControls != null)
{
TableControlRow[] rows = recControls.GetSelectedRecordControls();
this.Page.Session["RegistrationTableControl"] = rows;
// create XML writer to
using(System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(@"c: emp

[Code]....

I have take the XML data and place them in page 2 become the data source of the repeater.

View 2 Replies

Difference Between The Xpath And Xpathselect In .net Datalist?

Feb 17, 2011

I got this question from programming asp.net and web-site called quickstart.asp.net.In this it is mentioned that xpath and xpathselect is how used and syntex but it is not mentioned how it differs in work, i ckecked but both are giving same result.

View 1 Replies

Pass Xpath Value In Javascript Function?

Apr 5, 2011

here my code that gives error-

OnClientClick='javascript:DragRevId(<%# XPath("ReservationId") %>);return false;'

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved