|
I'd love to hear from anyone with an opinion on how to go about resolving the problem below:
I have a Web Service that allows for files to be uploaded. Because of the default limitation of 4MB in parameters, I allow repeated calls to the file upload function sending chunks of the file at a time. The Web Service then appends the file together at the server end. All works perfectly when running the Web Service on my computer, but when running the Web Service on a server (of which I am an Administrator) there is an issue.
In my Test program that calls the Web Service I setup Authentication:
l_wsService.PreAuthenticate = True
l_wsService.Credentials = CredentialCache.DefaultCredentials
My first call to the file uploading function works successfully. It's the second call to the same function that fails with the error "The request failed with HTTP status 401: Unauthorized". The program never gets inside the function the second time, failing on this error before it reaches the function. After the first call I reload one parameter with the next chunk of the file but don't change anything to do with the service or it's authentication settings.
When I have a file small enough not to break into chunks I can upload it and make subsequent calls to different functions within this same Web Service without a problem. When I have multiple small files the uploading of the second file fails.
My questions are:
How can I get this to work?
If this is a security problem then why does it only occur on the second call to this one function?
Regards,
Paul
-- modified at 20:14 Tuesday 14th February, 2006
|
|
|
|
|
Worked out the answer:
l_wsService.PreAuthenticate = False
It seems to go against everything that I have read on other websites, but it works.
I'd still love for someone to explain exactly why.
Regards,
Paul.
|
|
|
|
|
What is the windows based equivalent to System.Console.WriteLine? I read somewhere (but now cannot find where!) that when your are developing a Windows Application, you should avoid using System.Console.WriteLine and use something else instead.... what would this be? I want something very simple that I can quickly use just like System.Console.WriteLine.
Why I am asking...I am learning C# but prefer to learn using C# project that are Windows Applications. The examples in books use System.Console.Writeline. The code might contain a bunch of writeline statements for showing your results.
I know I could change the C# Output Type temporarily to Console Application and continue to use the System.Console.WriteLine. This solves my problem, but not in the way I would like to solve this. I thought there was some windows-based equivalent to System.Console.Writeline.
|
|
|
|
|
Debug.WriteLine() is what you're looking for. The output will only show up on any TraceListener or the Output window in Visual Studio.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have a Windows Form in C# that I'm hosting an activeX control in, which the dev env has automatically created the interop dll for. Everything works fine however there is a security issue that I'd like to close.
One of the properties on the ActiveX is a write-only BSTR that you provide a password. The interop layer exposes this as a managed string meaning I can't clear the memory storing the string once I've assigned it to the property.
I'm trying to figure out if I can modify the MSIL to marshal the property call to use either a SecureString directly or and IntPtr created using the Marshal.SecureStringToGlobalAllocUnicode. My early attempts to disassemble/modify/reassemble the interop dll have been less than successful so any guidance or suggestions would be welcome.
Many Thanks
Dave
|
|
|
|
|
When I am trying to install .NET i am very much able to install 'Disc 1' and 'Component'. But after I install Disc 1 it does not prompt me to enter Disc 2 and even if I enter Disc 2 there is no setup file in it. Please suggest.
UNI
|
|
|
|
|
It would help to know what version, edition, media type, etc.
Lost in the vast sea of .NET
|
|
|
|
|
As you all know, now hosting service only privde the .net 1.1 framework for me. I need do ajax using atlas, but I can't deploy my program on the .net 1.1 server.
Could anyone help me? i know the question is some of difficulty.
Thanks in advance.
Rudolf yan
|
|
|
|
|
|
Hi. I'm using a toolbar created with winForms on my Pocket PC 2002 app. The icons I assign to the toolbar buttons are 16x16 .png icons. I've 2 related problems: I'm actually seeing the "transparent" part of the icon (the toolbar background is gray, but I see the icon surrounded by a white square) and, in consequence, when I disable a toolbar button I don't see the shadow of the icon shape: I see the shadow of the square, so all the icons seem the same disabled. If I edit the icon and paint the "transparent" part with the toolbar background color I solve the first part of the problem, but when the icon is disabled I will still see an square.
I would really appreciate if anybody could tell me how to solve this problem or give me any clue.
Thanks,
Federico
|
|
|
|
|
I get the above error when creating a new project in VS .NET 03, and I've googled it and found few things to try, none of which help... I've done the v5.6 script deal.. I've tried re-registering some .olb's and .dll's that a few people posted, which didnt help either... Any ideas on why im getting this out of the blue?
"There are 10 types of people, those who understand binary, and those who don't."
- Somebody, not me.
|
|
|
|
|
|
Hi to all. I have a problem with my thesis. I'm realizing an application with VS .Net 2003 for PDA in C#.
I have a catalog stored into the PDA and I want to navigate into it.
I've builded a database which consists of 4 important tables: three categories tables (First, Second and Third) and the "Products" table.
I use a ListView object to navigate inside the categories. The code is this (I bolded the important part):
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.SqlServerCe;
using System.Data.SqlClient;
using System.Data;
using System.Reflection;
using System.IO;
namespace SmartDeviceApplication3
{
///
/// Form per sfogliare il catalogo - Form to navigate inside the catalog
///
public class FormSfogliaCatalogo : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.ListView listViewCatalogo;
public FormSfogliaCatalogo()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
listViewCatalogo.Activation = ItemActivation.OneClick;
listViewCatalogo.View = System.Windows.Forms.View.SmallIcon;
//Declare the connection variable
SqlCeConnection sqlConn1 = new SqlCeConnection();
try
{
// Open a connection to the database
sqlConn1.ConnectionString = "Data Source =\\My Documents\\db.sdf";
sqlConn1.Open();
SqlCeCommand searchCommand = new SqlCeCommand();
searchCommand.Connection = sqlConn1;
searchCommand.CommandText = "SELECT * FROM TIPOLOGIA_PRIMARIA"; // it means select * from first category
// Execute and return the rows in the data reader object
SqlCeDataReader dR;
dR = searchCommand.ExecuteReader(CommandBehavior.CloseConnection);
int nFields = dR.FieldCount;
// Setup the columns in the listview using the fields in the table
listViewCatalogo.Clear();
listViewCatalogo.Columns.Add("Categoria", -1, HorizontalAlignment.Left);
// Fill the rows in the listview using the data in the rows
int nRow = 0;
while (dR.Read())
{
// Create an array of subitems for quick insertion
// The subitems will be all fields in the row except for
// the first field
String [] subitems = new String[nFields];
subitems[0] = dR[3].ToString();
// Insert a new item into the listview, and add the subitems at
// the same time. The item will be the first field in the row
ListViewItem item = new ListViewItem(subitems);
listViewCatalogo.Items.Add(item);
ImageList imageListSmall = new ImageList();
imageListSmall.ImageSize = new Size(30,30);
imageListSmall.Images.Add(LoadImage("Dir.bmp"));
listViewCatalogo.SmallImageList = imageListSmall;
listViewCatalogo.Items[nRow].ImageIndex = 0;
++nRow;
}
dR.Close();
}
catch (Exception ex)
{
// If an error occured alert the user
MessageBox.Show("Error: " + ex.Message);
}
finally
{
// Close the connection if necessary
if (sqlConn1.State == System.Data.ConnectionState.Open)
sqlConn1.Close();
}
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormSfogliaCatalogo));
this.listViewCatalogo = new System.Windows.Forms.ListView();
this.panel1 = new System.Windows.Forms.Panel();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
//
// listViewCatalogo
//
this.listViewCatalogo.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listViewCatalogo.Location = new System.Drawing.Point(0, 56);
this.listViewCatalogo.Size = new System.Drawing.Size(256, 216);
this.listViewCatalogo.SelectedIndexChanged += new EventHandler(this.listViewCatalogo_SelectedIndexChanged);
this.Controls.Add(listViewCatalogo);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Gainsboro;
this.panel1.Controls.Add(this.label8);
this.panel1.Controls.Add(this.label7);
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.label5);
this.panel1.Controls.Add(this.pictureBox3);
this.panel1.Controls.Add(this.pictureBox2);
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Controls.Add(this.pictureBox4);
this.panel1.Size = new System.Drawing.Size(256, 56);
//
// label8
//
this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular);
this.label8.ForeColor = System.Drawing.Color.Blue;
this.label8.Location = new System.Drawing.Point(136, 32);
this.label8.Text = "Offerte e promozioni";
//
// label7
//
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular);
this.label7.ForeColor = System.Drawing.Color.Blue;
this.label7.Location = new System.Drawing.Point(32, 32);
this.label7.Size = new System.Drawing.Size(80, 20);
this.label7.Text = "Cerca prodotto";
//
// label6
//
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular);
this.label6.ForeColor = System.Drawing.Color.Blue;
this.label6.Location = new System.Drawing.Point(136, 8);
this.label6.Text = "Sfoglia catalogo";
//
// label5
//
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular);
this.label5.ForeColor = System.Drawing.Color.Blue;
this.label5.Location = new System.Drawing.Point(32, 8);
this.label5.Size = new System.Drawing.Size(80, 20);
this.label5.Text = "Aggiornamento";
//
// pictureBox3
//
this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
this.pictureBox3.Location = new System.Drawing.Point(112, 8);
this.pictureBox3.Size = new System.Drawing.Size(20, 20);
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
//
// pictureBox2
//
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(8, 32);
this.pictureBox2.Size = new System.Drawing.Size(20, 20);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(8, 8);
this.pictureBox1.Size = new System.Drawing.Size(20, 20);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
//
// pictureBox4
//
this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
this.pictureBox4.Location = new System.Drawing.Point(112, 32);
this.pictureBox4.Size = new System.Drawing.Size(20, 20);
this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
//
// FormSfogliaCatalogo
//
this.ClientSize = new System.Drawing.Size(258, 270);
this.Controls.Add(this.panel1);
this.Controls.Add(this.listViewCatalogo);
this.Menu = this.mainMenu1;
this.Text = "Catalogo";
}
#endregion
public void listViewCatalogo_SelectedIndexChanged(object sender, System.EventArgs e)
{
int sum = listViewCatalogo.SelectedIndices.Count;
int i;
i = listViewCatalogo.SelectedIndices[0];
if(listViewCatalogo.Items[i].Selected == true)
{
//to test the program
FormProdotto frm = new FormProdotto(i);
frm.Show();
return;
}
}
...
}
}
There are some problems:
1. If I deploy, I have no errors, but in executing phase I have error because the initialization of the listViewCatalogo.SelectedIndexChanged event is not correct, because it needs the items of the listview which are created dynamically (inside the "while dR.Read" clause);
2. If I put the eventhandler inside the "while clause", I have the problem that, for each row the listview creates dynamically, there is a call to my event (so I have X calls while I should have just one call, corresponding to the single item clicking).
I don't know where to initializes my event. Does anyone have a suggest?
Thank you.
Greetings from Italy
Nino
PS: Sorry for my bad English....
|
|
|
|
|
1.) You can use the SelectedIndex Property to check if an item is selected...
<br />
if(listView.SelectedIndex == -1)<br />
return;<br />
2.) It's recommend to disabling the updateing mechanism when you are adding items...
<br />
listView.BeginUpdate();<br />
<br />
while(...)<br />
{<br />
}<br />
<br />
listView.EndUpdate();<br />
<br />
By the way you should named you variables more significant...
|
|
|
|
|
HumanOsc wrote: 1.) You can use the SelectedIndex Property to check if an item is selected...
if(listView.SelectedIndex == -1)
return;
I don't have the definition SelectedIndex inside ListView. ('System.Windows.Forms.ListView' does not contain a definition for 'SelectedIndex')... I use VS .Net 2003 with CF 1.0.
I used this code, but I'm not sure if it has the same effect...
if (listViewCatalogo.SelectedIndices[0] == -1)
return;
Another question. In which point of the program should I use this code? Inside the definition of listViewCatalogo_SelectedIndexChanged event?
When I deploy I have the same errors. If I declare the control inside or outside the while clause I have this message: Error: index (I mean, the variable passed to the last testing form(FormProdotto).
|
|
|
|
|
Show only the relevand code, and use the pre tag to make it readable.
---
b { font-weight: normal; }
|
|
|
|
|
sorry, it was my first message and it was very important for me, I'll remember for the next time!
thank you
|
|
|
|
|
Ok, sorry it was my fault... Sometimes i mix two different classes...
I mean the SelectedItems Property...
<br />
if(listView.SelectedItems.Count == 0)<br />
return;<br />
You should check the collection if it's contains items, before you get anyone...
Well, in your app in the SelectedIndex_Changed handler...
<br />
if(listViewCatalogo.SelectedItems.Count == 0)<br />
return;<br />
<br />
i = listViewCatalogo.SelectedIndices[0];<br />
<br />
-- modified at 7:28 Tuesday 14th February, 2006
|
|
|
|
|
Thanks a lot, I made the changes and now the running is quite good!
Bye
Nino
Look Torino 2006 - - - - - FORZA ITALIA!!!
|
|
|
|
|
hi everyone,
I would need to get access to third party snapins in MMC so I can read information from these MMC snapins and store this information somewhere else into a text file. I don't need to modify this information, I only need to retrieve it, so I don't need to work with MMC manually in GUI form but can create reports in text file form from these MMC snapins. Do you have any idea if there is a way how to get this information from 3rd party snapins programatically (if possible in a consistent way) ?
thanks & regards,
krompo
|
|
|
|
|
i am trying to build a "missed message" queue on a C# TCP server. many
of the devices connecting are mobile and may drop out in bad signal
areas. i want to store any messages missed for when they reconnect.
so far....it takes activity on the client end to initialize the close.
isnt there a check when the server sends a socket.send to a client that
has lost connection? it takes a few minutes for the exception to get
hit, and i am losing vital time.
is there a way for as soon as the the server attempts Socket.Send it
can tell if the device on the other end still has an active connection?
even Socket.Poll() has quite a delay.
i have been testing with desktops. I connect two workstations to the
server and when i chat back and forth, i unplug one from the network.
it takes at least two minutes for the server to recognize that one
client is disconnected while the still-connected client is sending
messages. it seems they are just going nowhere.
|
|
|
|
|
please,
how can i make an activex control (i need an ocx file! and not a dll) with visual studio .net and c#?
thanks! kopi_b
|
|
|
|
|
Don't corss post in multiple forums. It's considered rude...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In a vb. Net application I have to set user Level Code ACcess Permission. a Program Manager user can select a user and select applications he has permission to access.
So that when next time that user loggs in he won't be able to access those applications which he has no permission. I am not able to find a way to set Userwise FileIoPermissions . Pls Help me .
Indu
|
|
|
|
|
I have an app created by VS2003. The launch conditions of .net framework's supportedRuntime is V1.1.4322. It can be installed in those machine had this version. I have another machine that only have the newest version framework V2.0. When I installed it, it asks me to install the .net framework V1.1.4322. I think that should not happen when the computer has the newest version .net framework in it. But my app can't be installed. Is there anybody know how to solve this issue?
THANKS!!
Lisa
|
|
|
|