|
|
Hi all,
I'm trying to create a login that should use Windows Authentication.
This is what I have done so far:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Login1.UserName == "admin" && Login1.Password == "admin")
e.Authenticated = true;
}
So how can I authenticate the username and password with the windows logon??
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
just use win32 api to impersonate with your user credentials.
try something like
[DllImport("advapi32.dll", CharSet=CharSet.Auto)]<br />
public static extern int LogonUser(String lpszUserName,<br />
String lpszDomain,<br />
String lpszPassword,<br />
int dwLogonType,<br />
int dwLogonProvider,<br />
ref IntPtr phToken);
regards
j.
|
|
|
|
|
Hello,
I am developing C# application which is having some hardware dependencies. While initializing application in one of my class i am starting all harware threads. When i modify some settings i need to restart the application.
How can i make sure that all threads should be killed before doing Application.Restart()?
Is their any way which will kill all running threads simultaneously instead of killing specific threads one by one.
Thanks.
|
|
|
|
|
gajesh wrote: Is their any way which will kill all running threads simultaneously instead of killing specific threads one by one.
i suspect there no other way to do this. You need to kill one by one. Where you are storing the thread objects ? You can loop through this and stop all.
|
|
|
|
|
Erhm, a background thread (set the IsBackground property to true) will be killed automatically as soon as the 'main' process is killed. I'm not sure if this also goes for Application.Restart();
Please vote my message! Click on one of the numbers beside ' Rate this message'.
.: I love it when a plan comes together :.
http://www.zonderpunt.nl
|
|
|
|
|
Thanks Eduard.
You are correct, Application.Restart() is not killing main process.
|
|
|
|
|
How to calculate the Daily,Weekly & Monthly time Duration from breaktime (i.e.,calculated from Outtime & Intime)?
Breaktime Code
TimeSpan minus = (TimeSpan.Parse(txtin.Text) - TimeSpan.Parse(txtout.Text));<br />
txtdur.Text = Convert.ToString(minus);
A.W.Abdul Sathar
|
|
|
|
|
Use Substract method of TimeSpan class.
Visit my blog at http://dotnetforeveryone.blogspot.com/
|
|
|
|
|
Now I understand I can use
System.Diagnostics.Process.Start("http://some.url.com");
to launch the default browser and navigate to a specific page, and I also understand that I can launch a specific browser, which will then go to the default home page using
System.Diagnostics.Process.Start("iexplore");
However, is there a means of launching the default browser to the default homepage? (without checking the registry to see what the default browser is preferably)
Perhaps there's some special url I can navigate to (like about:blank, but representing the default homepage)
I have no blog...
|
|
|
|
|
Erhm, the default browser setting is stored in the registry, su you'll need to check the registry in order to find the default browser.
Why don't you want to check the registry?
Please vote my message! Click on one of the numbers beside ' Rate this message'.
.: I love it when a plan comes together :.
http://www.zonderpunt.nl
|
|
|
|
|
Eduard Keilholz wrote: Please vote my message! Click on one of the numbers beside 'Rate this message'.
That's lame...
|
|
|
|
|
I voted. I don't think he'll be happy, but I voted.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
True. He solicited a number near 'Rate this message'. And the most nearest number was '1'.
|
|
|
|
|
Click on one of the numbers beside 'Rate this message'.
Always happy to oblige
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Eduard Keilholz wrote: Click on one of the numbers beside 'Rate this message'
So the most nearest number and that which was specified in your request was granted, which is also the 'Univoter ' Fame: 'The Unique Number One '
|
|
|
|
|
I think you'll have to check the registry to see which application is registered by default to open the htm/html files and launch that one. Another option in to use PInvoke. I think the function needed is FindExecutable from shell32.dll. See www.pinvoke.net[^] for more info on that.
|
|
|
|
|
System.Diagnostics.Process.Start("about:home");
works for me. but then iexplore is my default browser so i'm not sure about other browsers but maybe you can test?
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Works in ie, no go in FF, that's the sort of thing I'm looking for though thanks!
I have no blog...
|
|
|
|
|
I have a database query that will, for purpose of discussion, return either 1, 2 or 3 results. It could be any of these sizes.
I also have an array with 3 values in it. This is fixed.
I want to loop from i = 0 to 2 and compare a field's value from query row i to the value in array row i and do something if they match and do something different if they don't.
However, since I will always be looping 3 times and sometimes my query result will only have 1 or 2 rows in it, how do I check to see if the query row index exists before I go forward with the comparison?
Something along the lines of IfExists(mydata.Rows[0]) == TRUE is what I'm looking for. Any ideas? Thanks in advance! -Kari
|
|
|
|
|
store 1,2 and 3 in ArrayList.
Arraylist has one method to check value is contains or not.
Arr.Contains(mydata.Rows[0]);
bEST rEGARD
pATHAN
---------------------------------------------------
|
|
|
|
|
if you are using SqlDataReader then you can use
SqlDataReader datareader = dataCommand.ExecuteReader();
int i = 0;
while (datareader.Read())
{
if (datareader.GetByte(0) == array[i])
{
}
i++;
}
Becoming Programmer...
|
|
|
|
|
I'm programming in c#.
I' have a problem with database insert procedure. I need read the last record in a table because I need the last key and insert a new record with key + 1.
For this procedure I open connection, select the last key, insert the new key and close conncetion.
The problem message is: There is already an open DataReader associated with this Command which must be closed first.
How to make this insert without leave the database? I can problem with the concurrent coneections.
Thanks.
Diego
|
|
|
|
|
You should close your DataReader object before executing the code that performs your insert.
BTW, this doesn't look like the most efficient way of adding a new record. You should consider wrapping the whole operation in a stored procedure that selects the latest key to determine the new key value and then inserts the new record with this key.
Paul Marfleet
|
|
|
|
|
do you have an example of this operation? thanks
|
|
|
|