|
I have come up with an authentication scheme that I wanted to run past everyone to see if you all agree with my logic. Here is the process:
1) The clients windows login credentials are automatically passed (manual option also provided) with the webservice call using:
WebService.Credentials = System.Net.CredentialCache.DefaultCredentials
2) The web.config is set to impersonate the user.
3) At this point I thought I could assume that the client is who they say they are since the user was able to log in to IIS. My plan is to use the username and SID to retrieve the information for that user as opposed to the traditional username and password scenario.
4) If the user's SID is ever out of sync I will provide the admin a sync option. Basically the same option I would have given them when they set up the user.
I guess I am worried about two things. Can I rely on these SID's as long as the user is not recreated in the domain and hopefully I can store the SID's in a database. I am not sure how "variable" in length these SID's can be. If I stored it in a character field at 255 will I be safe?
|
|
|
|
|
Hey all,
I am trying to load and parse a MIDI file in C#. So far, I have been able to read the header and make it to the first track. However, I am now confused. Some values in the file are kept as a variable length format (link to the page I am looking at: MIDI File Format[^]), and I am not sure how to manipulate this. Basically, it shifts bits around like so: C8 (11001000) becomes 8148 (10000001 01001000). The top bit is used to signal that another 7 bits of information follow. So... I guess I need to know how to move the bits back into a format that I can use. Is there a way to handle individual bits in C#?
|
|
|
|
|
|
Thanks a bunch for the reply. I tried using the first link, but got confused. The last link seems to be very helpful, almost exactly what I need. Thanks again
|
|
|
|
|
I have an application that logs data based on messages sent to it from another app. It works great.
Now I want to hide it from the taskbar and live in the system tray (Notify Icon area).
When I call "ShowInTaskbar = false;" for my mainwindow, it stops recieving the messages.
I am registering the message in question and sending it to my app with a HWND_BROADCAST.
Any Ideas?
|
|
|
|
|
Hi!
I'm using a similar approach in one of my projects (although the hidden window is created from C++) and it works nicely, so it shouldn't be a general problem.
Could it relate to the fact that switching ShowInTaskbar recreates the window handle?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi guys,
I tried googling but no luck, please help, I need to confirm that a particular report was printed after printtoprinter is called. Please advice on how to achieve this.
sasa
|
|
|
|
|
I am trying to remove some images in a temperary directory when a user loses their session. Session_OnEnd is ignored when the Session State is set to "SQLServer". Does anyone have any ideas on how I can do this when the application is set to SQLServer mode? Thanks!
|
|
|
|
|
I figured I'd ask before rewriting to test the alternate implementation.
Is there any significant performance difference between:
for (i = 1; i < bignum; i++)
myStreamWriter.WriteLine(GetNextLineOfData))
and
for (i = 1; i < bignum; i++)
myStringBuilder.Append(GetNextLineOfData())
myStreamWriter.Write(myStringBuilder.ToString())
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
Yes, the second one is using a StringBuild to build a very large string, then calling ToString on it to create a new String object, then your writing the new string out to a file.
The two pieces of code are no doing the same thing. Your appending some data to a StringBuild, then creating a new String of all the data, appending some more data, creating a new String of all that data, ..., .... The string is getting bigger and bigger and bigger and your recreating the beginning part of the string over and over again with each pass. Your writing out something akin to:
1111 11112222 111122223333 1111222233334444 11112222333344445555 111122223333444455556666
whereas the first little snippet is doing this:
1111
2222
3333
4444
5555
6666
|
|
|
|
|
Hi Dave,
Dave Kreskowiak wrote: The two pieces of code are no doing the same thing
Indentation suggests and absence of curly brackets causes the output to be the same.
But I fully agree, the big string (and the iterative growth of the StringBuilder) are
bad for performance.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
No semicolons either, so I really couldn't do anything other than guess...
|
|
|
|
|
the intended output from both was intended to be the same and what Dave had as his second sample output. The missing semis were an oversight since I wasn't able to copy code directly the actual generation of the batch file being rather more fugly and not suitable for a copy/paste/cleanup process.
I'd posted the question since I didn't know what the StreamWriter was doing internally. I strongly suspected that the later would be faster if the StreamWriter had a simple implementation, if it was using a stringbuilder as an internal buffer and waiting until it had a predetermined optimum amount of text before dumping to the disk there wouldn't have been any actual speedup from the change.
I guess I should've explained what I was doing a bit better, but I'd something else to do and was trying to post as quickly as I could while still being understandable. Obviously I failed in the attempt.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
Hi Dan,
AFAIK the general answer to your question is streams are intended to facilitate AND
optimize what you are trying to do, so there is no need, no benefit, in organizing
your own buffering scheme. Streams use their own buffering system, which incidentally is
not based on StringBuilder since a stream can write/read a lot of different types.
Regards.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
In Explorer under Details file view there is a tab you can add called Pages that works for Tiff Images.
In a program I'm writing, I'm trying to get the page count of tiff images without involving
<br />
Image img = Image.FromFile(fnsQueue.Peek());<br />
Guid[] guid = img.FrameDimensionsList;<br />
FrameDimension fd = new FrameDimension(guid[0]);<br />
int pgCount = img.GetFrameCount(fd);<br />
img.Dispose();
I'd rather not have to pull the image into memory to get the frame count, is there a way I can access the pages attribute without resorting to the image bit? I've been exploring FileInfo but have not found anything yet.
Appreciate the help.
|
|
|
|
|
There is nothing in the .NET BCL that will do this without loading the file. You'd have to either write your own, or use a third party library that can get the attributes directly from the file without loading it. I, myself, don't know of any because image processing isn't in my main line of work.
|
|
|
|
|
With FileInfo.Attributes I found that the tiff image is an archive. Is there anyway to do a filecount inside of an archive within .NET, without of course moving the whole file into memory.
|
|
|
|
|
Lord_Veralix wrote: Is there anyway to do a filecount inside of an archive within .NET, without of course moving the whole file into memory.
No, and no. Again, a third party library. You simply have no way of doing this without writing your code code, or using a third party library, to read the file and parse the .TIFF data.
|
|
|
|
|
Shell32.ShellClass sc = new Shell32.ShellClass();
Shell32.Folder folder = sc.NameSpace(fromFile.Substring(0,fromFile.Length - fileName.Length));
Shell32.FolderItem folderItem = folder.ParseName(fileName);
Console.WriteLine(folder.GetDetailsOf(folderItem, 13));
|
|
|
|
|
And this has what to do with getting the data out of a TIFF file?? Nothing, I asure you...
|
|
|
|
|
Actually, this does exactly what I needed. It gets the frame/page count from the header without loading the entire file into memory. I found it when trying to read up how to retrieve ID3 tags from an Mp3. I don't quite understand why you're so adamant about how it's not possible, but here you go... Found my own solution. Thanks for your help I guess.
|
|
|
|
|
Because I would expect it to not know the TIFF file format.
|
|
|
|
|
Lord_Veralix wrote: without of course moving the whole file into memory
Maybe. Here's what I would try:
1. Find a specification for tiff file format somewhere on the Internet.
2. Read the spec. until you find where in the file it stores the frame count. (I'm assuming this will be stored in one or two bytes near the beginning of the file.)
3. Open the tiff file and read enough of it to get the relevant byte(s.)
4. Close the file.
5. Convert the relevant bytes to frame count.
Assume from step 2 above that the frame count is in two bytes at offset 14. Then do something like this:
FileStream stream = File.Open (path, FileMode.Open, FileAccess.Read);
byte [] buffer = new byte [16];
stream.Read (buffer, 0, 16);
stream.Close();
frameCount = (int) (buffer [15] * 256);
frameCount += (int) (buffer [14]);
I'm just guessing that the frame count is stored in the file header, but it might not be. Hope that helps, and good luck!
BDF
|
|
|
|
|
I want the user to be able to minimize to the taskbar and exit. but not resize or fit to screen.. There doesn't seem to be a form property to do this. Any help for the new guy? thanks.
|
|
|
|
|
Hi, I know of three ways to get this:
1.
Choose one of the fixed FormBorderStyles, say FixedSingle. And set MaximizeBox to false.
2.
Set MaximumSize and MinimumSize to the same value as Size.
Now Maximize will be selectable but fail, Minimize will succeed,
resizing will be selectable but fail.
3.
Choose whatever you want, and in the Resize handler if something is happening that you
don't like, undo it (check WindowState, if not Minimized force Size back to its desired value).
1. is the preferred approach since that form best shows what is and is not possible.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|