User Profile

Collapse

Profile Sidebar

Collapse
DonBytes
DonBytes
Last Activity: Sep 30 '08, 09:16 PM
Joined: Aug 23 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • DonBytes
    replied to download webdoc VB.NET
    in .NET
    Try setting the correct headers for the HttpWebRequest. The class above WebClientEx should take care of keeping cookies between requests as long as you keep them within the using clause.
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to C# Application CookieContainer
    in .NET
    To explain further:

    Code:
    public class WebClientEx : WebClient
    	{
    		private CookieContainer cookies = new CookieContainer();
    
    		protected override WebRequest GetWebRequest(Uri address)
    		{
    			WebRequest retVal = base.GetWebRequest(address);
    
    			if (retVal.GetType() == typeof(HttpWebRequest))
    			{
    				((HttpWebRequest)retVal).CookieContainer = cookies;
    			}
    ...
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to download webdoc VB.NET
    in .NET
    This class should help you I was just about to post it in my own old question anyway:

    Code:
    	public class WebClientEx : WebClient
    	{
    		private CookieContainer cookies = new CookieContainer();
    
    		protected override WebRequest GetWebRequest(Uri address)
    		{
    			WebRequest retVal = base.GetWebRequest(address);
    
    			if (retVal.GetType() == typeof(HttpWebRequest))
    			{
    ...
    See more | Go to post
    Last edited by DonBytes; Sep 10 '08, 07:29 PM. Reason: misstype

    Leave a comment:


  • DonBytes
    replied to how to make a container.
    in .NET
    You could also make a custom control with three boxes that you then add through code which is probably easier to position and work with.
    See more | Go to post

    Leave a comment:


  • If it's not to long strings you could write them prepared for String.Format when you load them up such as:

    Code:
    String sBody = "ComputerName: {0}\r\nError: {1}";
    and then use them as:
    Code:
    email.Body = String.Format(sBody, sComputerName, sError);
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to Problem with reading a File
    in .NET
    Been a long time since I did anything in VB but the File class has a method called OpenRead if I recall correctly.

    So perhaps something like this would work:
    Code:
    Using objSR As StreamReader = New StreamReader(File.OpenRead(sLicenseFile))
    
    End Using
    and then use objSR.ReadToEnd ()

    Also there is a FileStream class where you can specify FileAccess which might help if the above code doesn'...
    See more | Go to post

    Leave a comment:


  • DonBytes
    started a topic C# Application CookieContainer
    in .NET

    C# Application CookieContainer

    Wondering if anyone had problems with the CookieContainer s, I was making a program that logs onto sites, check for news and then reports back.

    All cookies domain in response.cookie s is marked as site.com except for one that is marked as .site.com for some reason this doesn't make it back to http://site.com when I try to check the messages page after doing the login.

    If I override the WebResponse in WebClient and add...
    See more | Go to post
    Last edited by DonBytes; Sep 8 '08, 06:14 PM. Reason: Stupid title as I missed the important word

  • DonBytes
    replied to Need Files to Distribute .Net
    in .NET
    http://download.microsoft.com/downlo...dotnetfx35.exe...
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to Problem with System.IO.Path.Combine()
    in .NET
    It only misbehaves when you feed root directory without slash as first argument. Always has as long as I've used it. So does:
    Code:
    DirectoryInfo dir = new DirectoryInfo("C:")
    But both of these will work:
    Code:
    Path.Combine(@"C:\Some Dir", "File.txt");
    Path.Combine(@"C:\Some Dir\", @"File.txt");
    I've always assumed it's because C: is not a valid place on the...
    See more | Go to post

    Leave a comment:


  • If sourceofdata is another table that looks the same you can use:

    Code:
    foreach (DataRow dr in sourceofdata.Rows)
    {
    ...
    }
    if it's another DataSet:
    Code:
    foreach (DataRow dr in sourceofdata.Tables[0].Rows)
    {
    ...
    }
    Change 0 to the index you want or the name of the table as string.
    See more | Go to post
    Last edited by DonBytes; Sep 1 '08, 07:55 PM. Reason: Misstype

    Leave a comment:


  • DonBytes
    replied to Website Screen Capture Application c#
    in .NET
    Look at this it should be what you want.
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to Recursive Update Query for SQL server
    As far as I know you can't turn on auto increment on a table that looks like that you'd have to do something like:

    Step 1:
    Code:
    sp_rename 'TableName', 'TableName_old';
    Step 2:
    Code:
    CREATE TABLE [TableName] (Id INT IDENTITY, Name VARCHAR(50));
    INSERT INTO TableName (Name)
    	SELECT Name from TableName_old;
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to Create XML file with C# or ASP
    in .NET
    I believe you'd have to create it yourself using XmlDocument and CreateElement for each row/column. You can save it and then load it (if it exists) prior to adding items.

    I really don't see any other way of getting the extra level (<item>) in there neither.
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to MS Dos command
    in .NET
    A bit overkill but as I am pretty much certain copy and xcopy can't do what you want here goes:

    Code:
    robocopy.exe . "C:\Destination Directory" Filename /XC
    In my example I assumed robocopy was in the path and executed in the folder where the file was. If you execute from another folder you'd have to:
    Code:
    robocopy.exe "C:Source Directory" "C:\Destination Directory" Filename /XC
    ...
    See more | Go to post
    Last edited by DonBytes; Aug 31 '08, 08:33 PM. Reason: Clarification

    Leave a comment:


  • Yeah, C# can handle strings with spaces whereas arguments can not, but when chaining batch files it's easy to get lost on where you need to quote and where you do not.

    Also, looking through it again, the space first in arguments is not needed as it'll be separated anyway.
    See more | Go to post

    Leave a comment:


  • DonBytes
    replied to MS Dos command
    in .NET
    You could copy it with C# and set overwrite to false? or is that some scheduled task that runs beside your program?
    See more | Go to post

    Leave a comment:


  • According to row 13 of the posted code he does set it though. However he sets it using this:
    Code:
    psi.WorkingDirectory = InQuotes(pathToScripts);
    WorkingDirector y of the StartInfo object shouldn't have the path quoted, it'll default to whatever folder the parent process had when it can't find a path like "C:\Windows ". Here's a working sample without the try catch bit though:
    Code:
    //----------------------------------------------------------------------------------------------------------
    ...
    See more | Go to post

    Leave a comment:


  • If [DropDownStyle] is set to [DropDown] you can just do:
    Code:
    comboBoxName.Text = "12";
    See more | Go to post

    Leave a comment:


  • Can't really help you with your problem but I just recently did this for the normal Save As dialog box (the one Notepad etc use) and the way I ended up doing it was by the Registry. Here's an export of the keys:

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\comdlg32\PlacesBar]
    "Place0"=dword:00000000
    "Place1"=dword:00000011
    ...
    See more | Go to post

    Leave a comment:


  • Code:
    sText = Regex.Replace(sText, "</?(font|div)[^>]*>", String.Empty, RegexOptions.IgnoreCase);
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...