|
OK,I have being a WebServer,
client is IE or Firefox
WebServer suppost http 1.0
when Client connect to server http://192.168.1.15/Nhat.txt,then Sever will do:
+ to client connect
+create socket to transfer file to client
if Nhat.txt is not Exist then transfer to client "Http /1.1 404"
I see IE understand but firefor don't.
I want to ask you about String code error 404
help me
|
|
|
|
|
is the 404 being automatically generated by the framework, or by custom code you wrote. IF the latter post the code generating the 404.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
int statuscode=404;
String headerbuffer=null;
String htmlbuffer=null;
htmlbuffer="Error: "+statuscode+"";
headerbuffer="HTTP/1.0 "+statuscode+"\r\nContent-Type: text/html\r\nContent-Length: "+htmlbuffer.Length+"\r\n\r\n";
byte[] headerbuff = Encoding.UTF8.GetBytes(headerbuffer);
byte[] htmlbuff = Encoding.UTF8.GetBytes(htmlbuffer);
s_SocKetManageClient.Send(htmlbuff, 0, htmlbuff.Length, SocketFlags.None);
s_SocKetManageClient.Send(headerbuff, 0, headerbuff.Length, SocketFlags.None);
this is my code but firefor don't understand and title of IE write HTTP 404 not Found
help me
|
|
|
|
|
Why on God's Green Earth are you using Sockets for this???!!!
Use the http classes in the .Net framework and save yourself a lot of headaches. This isn't even worth discussing if you want to use sockets.
|
|
|
|
|
Im using iTextSharp to create a PDF. We're passing in several chunks of HTML to compose the display however iTextSharp's HTML to PDF parser just cant handle nested DIV elements with a horizontal alignment different from its parent. For instance:
[code]
<DIV align=center>
<u>
<DIV align=right>
TestRight
</DIV>
</u>
TestCenter2
</DIV>
[/code]
Will be displayed: TestRight and TestCenter2 both being centered. It just ignores the align right whereas the web browser does it correctly.
Unfortunately the itextSharp parser is too complex looking for me so I've opted to modify the original HTML string before passing it into the parser. Basically i was hoping for some code to move all child aligned chunks to the top level. But maintaining the original text formatting and text placement (ie. TestRight comes before TestCenter2) made my solutioon overly complex.
Anyone have a simple solution?
Im using ASP.NET & C# but I'm open to any source code solutoon.
Tx
|
|
|
|
|
Ouch, yeah that's a lot more clear than what you said before... I haven't worked with iTextSharp, but in my experience, things that claim to create PDFs out of other documents never work right. When I had to create a PDF on-the-fly for my previous company, I used XSL-FO and a Java servlet called Apache FOP. It's pretty good, but you can't just convert a document, you have manually write the XSL-FO file, and it's pretty tricky. The work is worth it though, because you can create very nice looking PDFs, and you can insert data if you want, although it does have to be inserted into the XSL-FO file before passing to the PDF engine.
http://xmlgraphics.apache.org/fop/[^]
The C# ASP.Net engine can connect to this with a standard http call, so you can pass the resulting files through and the user never knows that you temporarily went over to an Apache server.
|
|
|
|
|
How to make a DTS packages through C# in SQL 2000?
|
|
|
|
|
Hi,
I have a method to upload file using FTP.
By uploading to the one of the FTP server I have a problem by closing stream.
The file is uploaded successfully but when I try to close stream, then my application hangs up.
This is in line: strm.Close();
On some other FTP server everything works fine. Could be it a problem with FTP server? I gewt this error only by working with larger files.
How schould I solve it? Is it allways neccessary to close the stream?
Thanks
Wojtek
Bellow my upload method
Stream strm = null;
FileStream fs = null;
try
{
DirectoryInfo dirInfo = new DirectoryInfo(source);
//upload all archive file from source directory
foreach (FileInfo fileInfo in dirInfo.GetFiles("*.rar"))
{
// get the object used to communicate with the server
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri(string.Concat(hostName, "/", fileInfo.Name)));
//set ftp method
request.Method = WebRequestMethods.Ftp.UploadFile;
request.UseBinary = true;
request.Timeout = timeout * 1000;
request.UsePassive = true;
// set credentials
request.Credentials = new NetworkCredential(userName, password);
// the buffer size is set to 2kb
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
// opens a file stream (System.IO.FileStream) to read the file to be uploaded
fs = fileInfo.OpenRead();
// stream to which the file to be upload is written
strm = request.GetRequestStream();
strm.ReadTimeout = 5000;
// read from the file stream 2kb at a time
contentLen = fs.Read(buff, 0, buffLength);
// till Stream content ends
while (contentLen != 0)
{
// write Content from the file stream to the FTP Upload Stream
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
}
}
catch (WebException e)
{
output.AppendLine(e.Message);
}
catch (InvalidOperationException e)
{
output.AppendLine(e.Message);
}
catch (Exception e)
{
output.AppendLine(e.Message);
}
finally
{
// close the file stream
fs.Close();
strm.Close();
|
|
|
|
|
hi
well i have written a code to connect to remote machine and stop a particular service so that i could delete its log file.I am able to connect to remote machine and stop the service but i am not getting the exact command to delete the log file.
Pls look at the code below...
<br />
using System.Management; <br />
----- <br />
connOptions = new ConnectionOptions(); <br />
connOptions.Impersonation = ImpersonationLevel.Impersonate; <br />
connOptions.EnablePrivileges = true; <br />
myScope = new ManagementScope("\\\\" + SelectedComputer + "\\ROOT\\CIMV2", connOptions); <br />
object[] arrParams ={ "Del /q C:\\WINDOWS\\system32\\CCM\\Logs\\execmgr.log" };
try <br />
{ <br />
manageClass =new ManagementClass(myScope, new ManagementPath("Win32_Process"), new ObjectGetOptions()); <br />
manageClass.InvokeMethod("Create", arrParams); <br />
<br />
} <br />
catch <br />
{ <br />
MessageBox.Show("Access Denied or System couldn't be contacted!"); <br />
} <br />
If you ll look at this particular line
<br />
object[] arrParams ={ "Del /q C:\\WINDOWS\\system32\\CCM\\Logs\\execmgr.log" };
I am trying to delete this log like via this command but it isnt working where as i can start and stop the service of the remote machine via "net start ccmexec" and "net stop ccmexec"
I have tried this in local machine aswell and i am unable to delete the file..I guess there is something to do with delete command...????
Could anyone please shed some light over it...
Thanks a lot
|
|
|
|
|
I am currently working in Visual C# Express 2005, and I have been doing all my unit testing using forms in a seperate project in my solution. I am wondering if it is possible to use nUnit in C# express, as my project manager has told me this is not possible. Has any gotten nUnit to work with C# express?
|
|
|
|
|
Yes, it is. There's a description of how to make it work in this tutorial.
Standards are great! Everybody should have one!
|
|
|
|
|
Justin Perez wrote: my project manager has told me this is not possible.
Your project manager is wrong. I've used nUnit for quite some time now with Visual C# Express...
|
|
|
|
|
How can i serialize and generate an xml file of the derived class in c# that consists the 5 properties in that 3 are datasets and 2 are class objects.
and i am using c#.net 2005 and sqlserver 2005
can any one help me please
Thanks
Ksrs
raja
|
|
|
|
|
|
Hi Satips,
Thanks for sending the link.
Let me see, If i have any doubt can i ask you?
Thanks
Raja
|
|
|
|
|
Glad to Help Always
Regards,
Satips.
|
|
|
|
|
Hi Satips,
I did the xml serialization but i got a xml file with default xml schema.
because the class having the properties as dataset. if i use the xmlignore attribute i didn't get the default schema with xml file and also i didn't get the data.
so can u please help me how can i remove the default schema at the time of serialization.
Thanks
raja
|
|
|
|
|
|
One way to do this to override the base class serilization with your one implementation. By this you can very well use the default serilization dataset and then for the two class objects call the serilisation method implemented for their class.
|
|
|
|
|
Hi Jaiprakash,
I did the xml serialization but i got a xml file with default xml schema.
because the class having the properties as dataset. if i use the xmlignore attribute i didn't get the default schema with xml file and also i didn't get the data.
and we don't have writes to change base class.
so can u please help me how can i remove the default schema at the time of serialization.
Thanks
raja
|
|
|
|
|
hi all ,
I want to make a mulitple form application using C#. It is something like An event on 1 form should initialize the other form and or it should invoke the other form. I do not want an MDI applicaion. Can any1 help me out with that?
Thanks in advance
Sankalp Verma
|
|
|
|
|
Its a multiple form Windows application.
Sankalp Verma
|
|
|
|
|
This is all you need to get another forum up
MyOtherForm otherForm = new MyOtherForm();
otherForm.Show();
What you do for initialisation is up to you.
|
|
|
|
|
Thanks a lot .....i just needed that 1 step ......thanks a lot
Sankalp Verma
|
|
|
|
|
I am working on a application which uses MS office components Excel,Word, Outlook. i have used Interop Assemblies of office 2003. i have made sure that all of the required assemblies are registered in GAC.
I have also included the special folder (Global assembly cache Folder) in the deployment project build was successful and working fine with the operating system where Office 2003 is installed. but when i brought the setup to some other system where there is no office or office is installed other then 2003. it generates the following error:
Unable to cast COM object of type "Microsoft.Office.Interop.Word.ApplicationClass" to interface type "Microsoft.Office.Interop.Word._Application"............
i have made sure that interops which goes with my setup.exe have been registered successfully with the GAC.
i am unable to understand what is the problem.
Kindly help me, thanking you all in advance.
regards
Xprt
|
|
|
|