|
Hi,
How is it possible to use trusted connection for an Intranet site?
Intranet is using a webservice which is hosted on a web server on LAN.
This is the connectionstring that I am currently using for the intranet website in the company LAN.
<value>Data Source=SQLMachineName1\MSQL_DEV;Initial Catalog=DBdatabaseName;Persist Security Info=True;User Id=WebUserAccountName;Password=password;
I would like to use this connectionstring instead so that I can have more control over the logged in users.
If I do use this connectionstring the error it gives is:
Login failed for user (null). Not associated with a trusted sql server connection.
<value>Data Source=SQLMachineName1\MSQL_DEV;Initial Catalog=DBdatabaseName;Integrated Security=True
|
|
|
|
|
the problem is in your server rights, not in your code...
enjoy the code with you is my priority,
Blaise Braye
|
|
|
|
|
For information I am working with a bindinglist as datasource :
see the objectview project here: http://sourceforge.net/projects/objectviews
OK, i want to be more explicit,
It's really easy to work with them both.
But in my context, I have keys collections.
So I wanted to have an inputBox which would appear when the object bounded contains a key.
Of course this inputBox is asking a unique key for the new object (row...)
The idea is that once the object is created, the user is not allowed to edit the key column (which has been set in read only mode at generation time).
Currently, how am I working?
I have a control which extend the DataGridView and which is composed of an ObjectView
let's call them dgvExt and collection.
in dgvExt i have my implementation to generate columns, to know which are keys,...
in dgvExt I have a EventHandler which listen the collection.RowAdding event.
this event is sending in parameter the innerobject (null at this step) that will be bounded to the row.
so.. In my EventHandler, I am creating my self the new object if it contains keys.
and I set it in the parameter sent by collection.
maybe you will understand why I want to work like this when you'll this code:
void collection_RowAdding(object sender, InstanceEventArgs e)
{
InputBox ib;
Type type = typeof(ConfigurationElement);
if (e.Type.Equals(typeof(KeyValueConfigurationElement)))
{
ib = new InputBox("Insert the key", "Insert key");
if (ib.ShowDialog() == DialogResult.OK)
e.Instance = new KeyValueConfigurationElement(ib.EnteredText, "");
}
if (e.Instance != null && e.Instance is ConfigurationElement)
{
MethodInfo init
= typeof(ConfigurationElement).GetMethod("Init", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { }, null);
init.Invoke(e.Instance, new object[] { });
}
}
In fact the problem is not what I want to do here,
but how to cancel the adding process in dgvExt efficiently?
Why to cancel? the inputBox allow the user to cancel... but I don't want a row with empty key...
this problem is really hard for me... certainly I am just not on the right way.
enjoy the code with you is my priority,
Blaise Braye
|
|
|
|
|
The database is on server(sql server 2000).
The application run on the client pc's.
How can i update the data in the application when the data on server has been changed.
|
|
|
|
|
|
Thanks for the reply.
The application is a windows application is there a difference?
|
|
|
|
|
have a look at also
http://www.15seconds.com/issue/041006.htm[^]
I couldn't give you the answer to your question because I simply didn't try it.
For this kind of applications, I am using transactions
enjoy the code with you is my priority,
Blaise Braye
|
|
|
|
|
Hi Capuano,
You have to implement/design a sort of "push - pull" mechanism. You have identify what is changed ( tablesize, tablecontent, indexes .. etc ) and monitor that. Then push out a message to the users saying what has changed, or invoke a method that can update the clients with what ever you want. It not easy to give you a hard and fast anwser because your post lacks the information required to send you down the right path ( if there is such a thing )
Cheers,
|
|
|
|
|
The database is on server(sql server 2000).
The application (Windows application)run on the client pc's.
How to use the SqlTriggerContext to update the data in the application when data on server has been changed?
|
|
|
|
|
how to create a web service project ? i have to administrate a an application remotely so i need ro create a web service ? please who has a answer reply urgently
|
|
|
|
|
|
I have created a .net 2.0 windows application.
Trusted connection to connect to sql server.
Using sql server System_User, the application gets the loginname for the user in sql server.
Now I have created webservices to be used in this project.
It seems that I can not use my existng method (Trusted connection) to get the loginName of the user.
So in sql server, created a webuser account.
Everyone now is using the system using the webuser account.
But, this way I do not know exactly which user is using the application because all I see is webuser hitting the database through the application.
How do you suggest I log the users?
I was thinking may be I should create roles on the network. i.e. NormalUsers, managers, chairmen, etc,...
Then add the appropriate users to these roles on the network.
I can then create a login screen.
Windows application can then find the user identity. This user can then be traced from the users table in sql server and get it's ID. ID can be used to be inserted into the Audit table.
What do you think please?
THnaks
|
|
|
|
|
If it's an internal network and you have a domain, I would just use integrated security. To handle database access you can either impersonate a user temporarily, use a SQL server login, or give the users themselves access to the database. That prevents you from having to use a login screen but still gives you access to their identities.
In case you're not on a domain, you'll have to create a login page and roles and manage all of that. There should be plenty of examples out there on how to do that.
|
|
|
|
|
Frnds,
i m working in C#.
My client wish to have a clored text in a texbox if my textboxes are disabled .
Can anybody suggest me any method to solve this problem of mine.
reply me via email.
Thanks
Sumit Kumar
sumit.professional@gmail.com
|
|
|
|
|
You need to enable the textbox to change the text, then disable it again. You can set the text color as a property on the textbox, I thought.
sumit_kumar wrote: reply me via email.
No. Set up your account to use your address, and you'll get no spam from CP, no spam because people won't be able to trawl the site and find your address, and an email when people answer.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian,
Good anwser, but I do have a side note though
The grayed out bit is a standard behaviour on a disabled textbox. This cannot be changed. However, there are some ways around it though.
1. Override the OnPaint event of the textbox.
{
SolidBrush drawBrush = new SolidBrush( ForeColor ); //Use the ForeColor property
// Draw string to screen.
e.Graphics.DrawString( Text, Font, drawBrush, 0f, 0f ); //Use the Font property
}
Note: You need to set the ControlStyles to "UserPaint" in the constructor.
public MyTextBox()
{
// This call is required by the Windows.Forms Form Designer.
SetStyle( ControlStyles.UserPaint, true );
InitializeComponent();
}
or something like that.
2. ( one of my favorites and less complicated ). Set the textbox to readonly and change te colors. This will preserve the textbox properties, allowing you to do anything with it that you want, and still mimic a 'disabled look'
private void OnClickButton(sender object, EventArgs e)
{
myTextbox.ReadOnly = true;
myTextbox.Forecolor = System.Drawing.Color.Red;
myTextbox.Backcolor = System.Drawing.Color.Gray;
}
Cheers,
|
|
|
|
|
I thought you could set the Text property even when the textbox was disabled?
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
I didn't think so. I have recollections of writing code to do what I suggested, out of necessity
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
We use
File.WriteAllBytes("//full path",byteArray)
to write file on the drive of the system we are working.
But if we want that instead of writing on the same system, it writes on other system on the LAN while we have the privileges to write it then what should be given as parameters in this method or is their any other class that support this?
|
|
|
|
|
Can you map a network drive to that directory and write it that way?
|
|
|
|
|
No .... without maping the network drive ....is it possible? if it is then how??
|
|
|
|
|
Well, you should be able to write to a UNC path, but it would have a lot to do with permissions. Your application may be running under a different identity or a lower trust level than is required. For instance, I can successfully run this code on my network:
static void Main(string[] args) {
FileInfo fi = new FileInfo(@"\\othermachine\C$\IAmATest.txt");
using (StreamWriter sw = new StreamWriter(fi.OpenWrite())) {
sw.WriteLine("Hello World!");
}
fi.Delete();
}
There's nothing special required to write to this particular path. I have this inside a command line app and I'm running on a domain account, so I know that I have access to write to that path. If you're running under an NT service or IIS, you may want to impersonate a different user account.
|
|
|
|
|
Hi All,
I want to add seperator on toolbar. I am using the following code to add button.
HelpButton = (CommandBarButton)oStandardBar.Controls.Add(1, missing, missing, missing, missing);
//firstButton.Style = MsoButtonStyle.msoButtonCaption;
HelpButton.TooltipText = "Help";
HelpButton.Tag = "btnHelp";
HelpButton.Click += new _CommandBarButtonEvents_ClickEventHandler(ButtonClick);
AddImage(ref HelpButton, "Help");
Please suggest how I can add seperator between two buttons on toolbar.
Thanks in advance.
asd
|
|
|
|
|
Hi,
Add a new button to your toolbar. Change its name to <anythingyoulike> , ( eg. tbbSeparator1 ) and change its Style to Separator.
When you change the Style property of the button to Separator, it disappears from the toolbar, or at least it seems to. When a button is designated as a separator, it's simply an empty placeholder used to create a space between two buttons. Because this separator is at the end row of buttons, you can't see it.
Move it to the second position by selecting it in the ToolBarButton Collection Editor and clicking the up arrow that appears to the right of the Members list; this arrow and the one below it are used to move a button up or down in the list. Click OK to save your changes and your toolbar will now have a space between the two buttons.
Have fun!
Regards,
|
|
|
|
|
Thanks for the reply.
But I am creating the add inn application and creating the command bar through the code (C#).
For button style i am using
customButton.Style = MsoButtonStyle.msoButtonIconAndCaption;
and no seperator kind of style available for MsoButtonStyle
Thanks.
asd
|
|
|
|