|
First of all, I know this question is only partially relevant to C#, so sorry for posting it here.
I am trying to implement Facebook single sign on using a desktop application. The one thing I figured out so far is to retrieve an access token.
How I retrieve the access token:
browserFacebook.Navigate(@"https://graph.facebook.com/oauth/authorize?client_id="+ FacebookApplicationID + "&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup");
This redirects the user to page where he/she must first authorize the application. Once authorized, I redirect the user to "http://www.facebook.com/connect/login_success.html" as specified in the above address. I then intercept this URL to retrieve the access token like so:
string someString = browserFacebook.Url.ToString();
This returns something like the following:
"http://www.facebook.com/connect/login_success.html#access_token=ACCESS TOKEN.expires_in=0"
I can then easily use this access token with the Graph API to access an users facebook details as in the following code:
Facebook.FacebookGraphAPI g = new FacebookGraphAPI("ACCESS_TOKEN");
var fbUser = g.GetObject("me", null);
Can I also use this token somehow to simply log a user in to the site? My goal is not really to develop a complete new facebook application as my application is simply a prototype.
|
|
|
|
|
Hello everyone,
I am trying to set a column in my datagridview to be as datetimepicker column only.
It is so easy to do it if my datagridview is not binded within database, i did it by making a user control which transform datagridviewtextboxColumn to datetimepicker from Calendar().
But my question: i dont want to add a new column in my datagridview of type datetimpicker or maybe something else like datagridviewComboBoxColumn or else, i just want to change my column type:
For example changing DatagridviewTextBoxColumn to datetimepicker
or
DatagridviewTextBoxColumn to DatagridviewComboboxColumn
This can be done easily by setting my datagridview columns to specific columns, but my main concern is that my datagridview is already binded.
Hope i can have any help, coz this issue took lot of my time.
Thanks in advance.
Ronald
|
|
|
|
|
You cannot change column at run-time.
You cannot turn combobox column to datetimepicker column at run-time.
You can only decide column type at creation time.
Refer this[^] link for more information.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi
I'm using a WebBrowser control to enable users to browse Facebook, or atleast this is my goal.
Once I retrieved a Facebook session key, how do I redirect the browser to the Facebook Home page? Also, can I store a session key for each user and use this to log them in without having to prompt them for login details each time?
I retrieve the session key by directing the web browser to the url below and then intercepting this url:
browserFacebook.Navigate(@"http://www.facebook.com/login.php?api_key=" + FacebookAPIKey + @"&connect_display=popup&v=1.0&
next=http://www.facebook.com/connect/login_success.html&cancel_url=http://www.facebook.com/connect/login_failure.html&
fbconnect=true&return_session=true&session_key_only=true&req_perms=read_stream,publish_stream,offline_access");
|
|
|
|
|
I'm not familiar with Facebook, but isn't the API key tied to the application? (As opposed to the user?)
You can register your application here[^], and they'll provide a key for your application.
I are Troll
|
|
|
|
|
Yes it is, but I was talking about the session key, not the API key
|
|
|
|
|
The Session is only valid for 24 hours.
I are Troll
|
|
|
|
|
Apparently not if you set the expiry time to 0. Anyway, I don't think this is the best way to try and implement single sign-on. I'm just giving it a shot since I'm kind of at a dead end. I've got all the users' usernames and passwords, I just need to find a way to log them in automatically
|
|
|
|
|
Etienne_123 wrote: Apparently not if you set the expiry time to 0.
Don't know where you got this information, but the docs[^] state something else;
Users don't log out of desktop applications. A user's session expires after 24 hours,
or when the user closes your application. If you need to, you can terminate a user's
session by calling auth.expireSession.
I are Troll
|
|
|
|
|
Exactly - OR when the user closes the application. My application is meant to be run 24/7.
|
|
|
|
|
Is that a AND/OR or XOR ? Sessions are usually temporary, and according to the docs I just been reading, you'd want to request "offline access". See the bottom of this[^] page.
I are Troll
|
|
|
|
|
Please Friends Help me
i have 4 tables
1. Master Book Table (MBookId,BookId,AuthorId,PubId)
2. Book Name ( BookId,BookName)
3. Author Name (AuthorId,AuthorName)
4. Publisher Name (PubId, PubName)
DAL
UI Layer
DAL ----
Please suggest me how to achieve Datarelationship
DataRelation dr = new DataRelation("BookBookName",
ds.Tables["MBook"].Columns["BookId"],
ds.Tables["Book"].Columns["BookId"]);
ds.Relations.Add(dr);
is this right ?
and how to use this in UI to get data, insert,update, save.. etc
i google a lot but didn't find the right solution for my purpose
and is datarelation ship with dataset is better or NHIBERNATE
if nhiberate is better then do ineed to start in from start i mean i have to create the tables and all that once..........
i have already created the datatable and DAL methods of Save Edit etc....
Please Help
Thank you very much EveryOne..... (specially CODEPROJECT)
|
|
|
|
|
You need to do following.
DataRelation dr = new DataRelation("BookBookName",
ds.Tables["MBook"].Columns["BookId"],
ds.Tables["Book"].Columns["BookId"]);
DataRelation dr1 = new DataRelation("BookAuthorName",
ds.Tables["MBook"].Columns["AuthorId"],
ds.Tables["AName"].Columns["AuthorId"]);
and so on.
So you have finally four datarelation object.
Then add all relation object to dataset, like..
ds.Relations.Add(dr);
ds.Relations.Add(dr1);
ds.Relations.Add(dr2);
You can do navigation as follows
foreach (DataRow MBookRow in customerOrders.Tables["NBook"].Rows)
{
Console.WriteLine(MBookRow["MBookId"].ToString());
foreach (DataRow BNameRow in MBookRow.GetChildRows(dr1))
{
Console.WriteLine(BNameRow["BookId"].ToString() + " " + BNameRow["BookName"].ToString());
}
}
Refer this[^] link for DataSet Vs NHibernate.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Is there such good examples or explaination for this issue?
right now, I've got this....
Project A
* calling SeekHidDevices in Project B
* ReadPort method
Project B
* SeekHidDevices method & calling ReadPort method in Project A
* returns SeekHidDevices value back to Project A
I've got 2 devices but only got 1 (crashes when doing the 2nd devices in SeekHidDevices method during ReadPort calling.
|
|
|
|
|
This should not be a problem if the code is written correctly. The only time it would cause a problem is if methodA (in A) calls methodB (in B), which in turn calls methodA thus creating a closed loop. Having said that you may wish to review the design of your application.
It's time for a new signature.
|
|
|
|
|
Perhaps a better explaination of using "Interface"?
|
|
|
|
|
Blubbo wrote: Perhaps a better explaination of using "Interface"?
???
It's time for a new signature.
|
|
|
|
|
Blubbo wrote: I've got 2 devices but only got 1 (crashes when doing the 2nd devices in SeekHidDevices method during ReadPort calling.
I don't understand this bit at all...
But - how can you have created a reference to project a in project b as well as a reference to project b in project a? That's circular and shouldn't allow you to add the reference in the first place (in VS it gives you an error when you try to add the reference)
What you need to do is have project C which contains 'utility' functions - A and B both reference C - C can contain utility methods, classes, anything that needs to be more generally accessed.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Okay. I get the a bit of the idea what you're saying. Any example on this?
|
|
|
|
|
Hi,
I have a problem when i try to use stored procedure in C#.net. Well when i run the stored procedure in sql server , it works fine and when the same query if i run in C#.net without using stored procedure, it works fine too. But when i try to use stored procedure in c#.net, it gave errors. The error is like this:
System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object 'SelectItem', database 'Student', schema 'dbo'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at Default_View.DisplayItem() in C:\Documents and Settings\smanandhar\My Documents\Visual Studio 2008\Projects\StudentPortlet\Default_View.ascx.cs:line 285
the stored procedure is :
ALTER PROCEDURE [dbo].[SelectItem]
@UserID nvarchar (50)
AS
BEGIN TRANSACTION
select i.Item,i.ItemDescription,i.Category,i.Amount,i.SubmissionDate,i.ProposalID from ProposalItem i,Proposal j where
i.ProposalID = j.ID
and
j.UserID = @UserID
COMMIT TRANSACTION
and the code in C# is:
try
{
SqlConnection cnx = new SqlConnection(StudentPortlet.strCnx);
SqlCommand cmd = new SqlCommand();
cmd = new SqlCommand("SelectItem", cnx);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = "Unknown";
SqlDataAdapter adap = new SqlDataAdapter(cmd);
DataSet dtt = new DataSet("student senate budget testing");
adap.Fill(dtt);
System.Web.UI.WebControls.DataGrid grid = new System.Web.UI.WebControls.DataGrid();
grid.HeaderStyle.Font.Bold = true;
grid.DataSource = dtt;
grid.DataBind();
dgDisplayItem.DataSource = dtt;
dgDisplayItem.DataBind();
}
catch (Exception ex)
{
string s = ex.ToString();
}
sm
|
|
|
|
|
The problem is right in what you posted " The EXECUTE permission was denied on the object 'SelectItem', database 'Student', schema 'dbo'". What user is your site running as? And what does your connection string look like?
|
|
|
|
|
I defined the connection string in a class and the connection string looks like
public static string strCnx = "server=D324KJ43H2;uid=user;pwd=northpoint;database=Student"
I am login as administrator..
suchita
|
|
|
|
|
Use the following query to give execute permission to the procedure
GRANT EXECUTE TO SelectItem
Gg
http://ggaben-developer.blogspot.com/
|
|
|
|
|
hi
can any one suggest me quickest(optimized) way to call an stored procedure from my c# code for every row of data table (rows can be for example 20000)? what is "optimized" ?
|
|
|
|
|
SqlCommand command = new SqlCommand();
command.Connection = ...
command.CommandText = "sp_name";
command.Paramaters.Add("@paramName, System.Data.SqlTypes.SqlDecimal).Value = 0m; //use correct type param
using(SqlDataReader reader = command.ExecuteReader()){
while(reader.Read()){
//The reader contains the columns of each record
}
}//end using
|
|
|
|