The way I understand your issue you've got a C# console application
sitting on a server and you're trying to get it to run by calling the
console application from a client machine and this is not working.
You are able to get your console application to work if you log into
the server and run it. If this is the case I would assume it is a
trust issue. The server does not trust the client to allow it to call
the exe.
> Kiran**
On May 29, 6:00 am, kiran babu <asileti.ki...@gmail.com> wrote:
> Hi All,
>
> I am working on C# console application and when I tried to access the exe of
> the project from the remote machine, I am getting some problem. The main
> functionality is "The exe will execute couple of batch files, which are
> exist in the exe folder only.
>
> Currently, we have placed all required batch files and the exe in a shared
> folder of a server machine and we are accessing the exe from the client
> machines.
>
> When we tried to access the exe from the server machine, we are not getting
> any problem. But, when ever we tried to access the exe from the client
> machine, we are getting the problem.
>
> Here is my sample code:
>
> ProcessStartInfo psi = new ProcessStartInfo ( );
>
> psi.WindowStyle = ProcessWindowStyle.Normal;
>
> psi.FileName = @"Gen.bat"
>
> psi.Arguments = args;
>
> psi.UseShellExecute = false;
>
> psi.RedirectStandardOutput = stdout;
>
> psi.WorkingDirectory = Environment.CurrentDirectory;
>
> Process process = new Process ( );
>
> process.StartInfo = psi;
>
> process.Start ( );
>
> The above code was implemented for execution of the batch files. I don't the
> reason, why the above code is giving the problem, when we tried to access it
> from the remote machines.
>
> Could you please let me know "Is there any mistake in my code" and how to
> solve the above one?
>
> Thanks in Advance
>
>
> * *
Sunday, May 31, 2009
[DotNetDevelopment] Re: Execution of the batch files
[DotNetDevelopment] Need Help regarding updating a windows form screen with details using threads.
--
Regards,
A.Sanjeeva Kumar.
[DotNetDevelopment] Listening to WM_SETTINGCHANGE event in C# .NET
can any one give any pointer / code snippet / idea for my problem.
My Problem:
I would like to listen to a system message WM_SETTINGCHANGE inside a
C# class. And every time I get that message I would like to run some
specific instructions.
Thanks in advance.
Stupid Guy
[DotNetDevelopment] Extending the treenode in the treeview (C#)
how to extend the treenode within a treeview.
I want to be able to store information about each treenode ( over and
above the text/tag ) that are available as standard.
thanks
Richard
Saturday, May 30, 2009
[DotNetDevelopment] Re: Vb to vb.net
On May 30, 3:52 am, seoul Nainggolan <seoul...@gmail.com> wrote:
> someone said "If you want to fill the glass, you must empty the glass
> first"
>
> On Fri, May 29, 2009 at 3:34 PM, scania <joshualiwi...@gmail.com> wrote:
>
> > There are so many upcoming programmers who can do very well in VB, but
> > have no idea how to start in .net.
> > Is there anyway we can help them out in this forum.
>
> > Lets say we start with a simple question how do we start in .net wit5h
> > the experience got in vb
[DotNetDevelopment] Re: Vb to vb.net
There are so many upcoming programmers who can do very well in VB, but
have no idea how to start in .net.
Is there anyway we can help them out in this forum.
Lets say we start with a simple question how do we start in .net wit5h
the experience got in vb
[DotNetDevelopment] dataset.writexml() issue
fileLogger.Log(LogSeverity.Status, "Wrote out: " +
tmpFileName);
dtTemp.WriteXml(tmpFileName);
archivefiles.Add(tmpFileName);
This generates xml data that looks like the following
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
<user>
<FName>España</FName>
This is great and all - everything is there in all of it's unicoded
glory -however the folks consuming my file are not able to deal with
utf-16 encoding. How do I configure the writexml method to output
this instead (I don't want to simply change the header - I need to
escape international character to their utf-8 equivilents)
<?xml version="1.0" standalone="yes" encoding="utf-8"?>
<DocumentElement>
<user>
<FName>Espa&xxx;a</FName>
Much thanks!
Brian
P.S. I've tried using the XMLTextWriter too and setting the encoding
type to UTF-8 but I havn't had any luck there either.
[DotNetDevelopment] Re: Execution of the batch files
sitting on a server and you're trying to get it to run by calling the
console application from a client machine and this is not working.
You are able to get your console application to work if you log into
the server and run it. If this is the case I would assume it is a
trust issue. The server does not trust the client to allow it to call
the exe.
On May 29, 6:00 am, kiran babu <asileti.ki...@gmail.com> wrote:
> Hi All,
>
> I am working on C# console application and when I tried to access the exe of
> the project from the remote machine, I am getting some problem. The main
> functionality is "The exe will execute couple of batch files, which are
> exist in the exe folder only.
>
> Currently, we have placed all required batch files and the exe in a shared
> folder of a server machine and we are accessing the exe from the client
> machines.
>
> When we tried to access the exe from the server machine, we are not getting
> any problem. But, when ever we tried to access the exe from the client
> machine, we are getting the problem.
>
> Here is my sample code:
>
> ProcessStartInfo psi = new ProcessStartInfo ( );
>
> psi.WindowStyle = ProcessWindowStyle.Normal;
>
> psi.FileName = @"Gen.bat"
>
> psi.Arguments = args;
>
> psi.UseShellExecute = false;
>
> psi.RedirectStandardOutput = stdout;
>
> psi.WorkingDirectory = Environment.CurrentDirectory;
>
> Process process = new Process ( );
>
> process.StartInfo = psi;
>
> process.Start ( );
>
> The above code was implemented for execution of the batch files. I don't the
> reason, why the above code is giving the problem, when we tried to access it
> from the remote machines.
>
> Could you please let me know "Is there any mistake in my code" and how to
> solve the above one?
>
> Thanks in Advance
>
> Kiran**
>
> * *
[DotNetDevelopment] Re: Execution of the batch files
Hi All,
I am working on C# console application and when I tried to access the exe of the project from the remote machine, I am getting some problem. The main functionality is "The exe will execute couple of batch files, which are exist in the exe folder only.
Currently, we have placed all required batch files and the exe in a shared folder of a server machine and we are accessing the exe from the client machines.
When we tried to access the exe from the server machine, we are not getting any problem. But, when ever we tried to access the exe from the client machine, we are getting the problem.
Here is my sample code:
ProcessStartInfo psi = new ProcessStartInfo ( );
psi.WindowStyle = ProcessWindowStyle.Normal;
psi.FileName = @"Gen.bat"
psi.Arguments = args;
psi.UseShellExecute = false;
psi.RedirectStandardOutput = stdout;
psi.WorkingDirectory = Environment.CurrentDirectory;
Process process = new Process ( );
process.StartInfo = psi;
process.Start ( );
The above code was implemented for execution of the batch files. I don't the reason, why the above code is giving the problem, when we tried to access it from the remote machines.
Could you please let me know "Is there any mistake in my code" and how to solve the above one?
Thanks in Advance
Kiran
Friday, May 29, 2009
[DotNetDevelopment] Re: how to get the file type even if the file dont have a file extension?
header signatures of a few predetermined file types and match against
those.
I had a little utility that could recover certain file types from
CHKDSK recovered files, by reading their headers. This utility used
the above mentioned logic.
On May 29, 12:50 pm, aj <arden_caya...@yahoo.com> wrote:
> im having a problem on getting the file type of a certain file.
> im doing some research on file header, but no good. :(
[DotNetDevelopment] Re: connecting to database
On May 29, 2:47 pm, Mike Fry <mike...@iafrica.com> wrote:
> Cerebrus wrote:
> > ... and by the way, it's "Cerebrus". :P
>
> I know, but I think Cerberus suits you better as a moniker. Guarding the
> underworld that is .NET
>
> --
> Regards,
> Mike Fry
> Johannesburg.
[DotNetDevelopment] WCF and SSL
I'm trying to make my WCF application accept HTTPS connection, but it
just won't let me connect to the service.
Here's a snippet of the code I use to generate a (valid...?) .cer file
===== CODE =====
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = localPath + "makecert.exe";
proc.StartInfo.Arguments = "-r -pe -n \"CN=www.toto.com\" -b
01/01/2000 -e 01/01/2036 -ss my -sr localmachine -sky exchange -sp
\"Microsoft RSA SChannel Cryptographic Provider\" -sy 12";
===== END CODE =====
1rst question: is it an acceptable way to generate the certificate ?
Am I missing some vital information ?
And now, a snippet of the code I use to create my ServiceHost:
===== CODE =====
baseAddress = string.Format("https://{0}.{1}:{2}",
System.Environment.MachineName, domainName, this.tcpPort);
this.host = new ServiceHost(typeof(MySpace.WebServices), new Uri[]
{ new Uri(baseAddress + "/WebServices") });
BasicHttpBinding binding = new BasicHttpBinding
(BasicHttpSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType =
HttpClientCredentialType.None;
ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
behavior.HttpsGetEnabled = true;
host.Description.Behaviors.Add(behavior);
host.AddServiceEndpoint(typeof(IMyInterface), binding, baseAddress + "/
WebServices");
this.host.Credentials.ServiceCertificate.SetCertificate
(StoreLocation.LocalMachine, StoreName.My,
X509FindType.FindByIssuerName, "www.toto.com");
this.host.Open();
===== END CODE =====
The service starts with no errors, but when I try to connect I get the
following from Firefox : "Data transfer interrupted"
What am I doing wrong ?
Thanks in advance
[DotNetDevelopment] Execution of the batch files
Hi All,
I am working on C# console application and when I tried to access the exe of the project from the remote machine, I am getting some problem. The main functionality is "The exe will execute couple of batch files, which are exist in the exe folder only.
Currently, we have placed all required batch files and the exe in a shared folder of a server machine and we are accessing the exe from the client machines.
When we tried to access the exe from the server machine, we are not getting any problem. But, when ever we tried to access the exe from the client machine, we are getting the problem.
Here is my sample code:
ProcessStartInfo psi = new ProcessStartInfo ( );
psi.WindowStyle = ProcessWindowStyle.Normal;
psi.FileName = @"Gen.bat"
psi.Arguments = args;
psi.UseShellExecute = false;
psi.RedirectStandardOutput = stdout;
psi.WorkingDirectory = Environment.CurrentDirectory;
Process process = new Process ( );
process.StartInfo = psi;
process.Start ( );
The above code was implemented for execution of the batch files. I don't the reason, why the above code is giving the problem, when we tried to access it from the remote machines.
Could you please let me know "Is there any mistake in my code" and how to solve the above one?
Thanks in Advance
Kiran
[DotNetDevelopment] How To Create A Connection To Local Data Base
I Want To Create A Connection Like This "Data Source=COMP01\
\SQLEXPRESS;Initial Catalog=Avd;Integrated Security=True" to Local SQL
Server Data Base Which is located in the debug Folder . Can You Help
Me ?
Thanks ....
[DotNetDevelopment] Re: http post
Thank you Nivas. However I'm still having an issue where I'm getting
an HTTP 500 error. I found some information about adding a line in
web.config to allow HTTP Post as opposed to SOAP, but that didn't seem
to lead anywhere. Did you have to do anything like that? Also what
does your web method look like. Is it something like this?
[WebMethod]
public string PostXML(Stream fileByteStream)
{
if (Process(fileByteStream))
{
return "OK";
}
else
{
return "Fail";
}
Thanks again, Rico
On May 28, 3:50 am, "tha. NIVAS" <mdni...@gmail.com> wrote:
> Hi Rico,
>
> This is how i implemented the Http post.
>
> String result = string.Empty;
>
> StreamWriter myWriter = null;
>
> string url = ConfigurationManager.AppSettings["Host"];
>
> //Creating a WebRequest
>
> HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
>
> httpWebRequest.Method = "POST";
>
> httpWebRequest.ContentLength = xmlMessage.Length;
>
> httpWebRequest.ContentType = "text/xml;charset=ISO-8859-1";
>
> httpWebRequest.Headers.Add(HttpRequestHeader.Authorization,
> ConfigurationManager.AppSettings["Authorization"]);
>
> try
>
> {
>
> myWriter = new StreamWriter(httpWebRequest.GetRequestStream());
>
> //Writes to the host sever
>
> myWriter.Write(xmlMessage);
>
> }
>
> catch (Exception e)
>
> {
>
> throw e;
>
> }
>
> finally
>
> {
>
> if (myWriter != null)
>
> {
>
> myWriter.Close();
>
> }
> }
>
> //Getting response from host server for our request
>
> HttpWebResponse objResponse = (HttpWebResponse)httpWebRequest.GetResponse();
>
> using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
>
> {
>
> result = sr.ReadToEnd();
>
> // Close and clean up the StreamReader
>
> sr.Close();
>
> }
>
> Regards,
> Nivas
>
>
>
>
>> tha.NIVAS- Hide quoted text -> On Thu, May 28, 2009 at 11:42 AM, Rico <ericabra...@gmail.com> wrote:
>
> > Hello Nivas,
>
> > I'm trying to do a similar thing. Could you please post your code for
> > the POST and for the web service?
>
> > Thanks,
> > Rico
>
> > On May 26, 11:04 pm, (¯`·._.·NIVAS·._.·´¯) <cdni...@gmail.com> wrote:
> > > Hi Cipto,
>
> > > Thanks for your reply. I have implemented that usin HttpWebRequest and is
> > > done.
> > > Thanks all.
>
> > > On Tue, May 26, 2009 at 8:14 AM, cipto john <ciptoj...@gmail.com> wrote:
> > > > if from javascript
> > > > Use post on xmlhttprequest. set to post and then set your xml as
> > > > string.handle it on server write the string to xml file
>
> > > > if from other type application
> > > > Using FTP would be nice.
>
> > > > of you build your tcp listener accept client bla bla bla
>
> > > > There is nothing to do with ssl, ssl is just encryption.
>
> > > > On Mon, May 25, 2009 at 9:12 PM, ¯`·._.·NIVAS·._.·´¯ <
> > cdni...@gmail.com>wrote:
>
> > > >> Hi Chris,
> > > >> Its not meagre upload file. I have to send xml content as data using
> > http
> > > >> post and inturn another webserver will give response for my request.
>
> > > >> On Fri, May 22, 2009 at 4:54 PM, Chris Marks <chris.ma...@gmail.com
> > >wrote:
>
> > > >>> "Send" ? - perhaps use of a webservice, or if it's just literally to
> > > >>> send/upload a file an XML file to a remote webserver, how about
> > > >>> connecting via FTP?
>
> > > >>> On May 22, 7:38 am, Nivas <cdni...@gmail.com> wrote:
> > > >>> > Hi,
>
> > > >>> > i need to send a xml file to another webserver, which i want to do
> > in
> > > >>> > csharp. how to do this?
> > > >>> > Maybe have to do something with SSLSocket.
>
> > > >>> > Thanks in advance.
>
> > > >> --
> > > >> Tha.Nivas,
> > > >>http://cdnivas.blogspot.com
>
> > > --
> > > Tha.Nivas,http://cdnivas.blogspot.com-Hide quoted text -
>
> > > - Show quoted text -
>
> --
> Regards,
>
> - Show quoted text -
--
Regards,
tha.NIVAS
[DotNetDevelopment] Re: connecting to database
> ... and by the way, it's "Cerebrus". :P
I know, but I think Cerberus suits you better as a moniker. Guarding the
underworld that is .NET
--
Regards,
Mike Fry
Johannesburg.
[DotNetDevelopment] Vb to vb.net
have no idea how to start in .net.
Is there anyway we can help them out in this forum.
Lets say we start with a simple question how do we start in .net wit5h
the experience got in vb
[DotNetDevelopment] Re: Problem with a namespace...
collected the code, seems like some code like a compiled dll is
missing of which it is referring to.
[DotNetDevelopment] how to get the file type even if the file dont have a file extension?
im doing some research on file header, but no good. :(
[DotNetDevelopment] Re: connecting to database
... and by the way, it's "Cerebrus". :P
On May 29, 4:41 am, jt_2009 <jth...@gmail.com> wrote:
> Hi Naveen & Cerberus
>
> Thanks for the info. The SQL server is setup for windows
> authentication. I am trying this method currently just so I can get
> the connection to the db step done - as mentioned I am very raw to all
> this and not much of a programmer really (but I am finding it
> enjoyable - with good help obviously :D)
>
> I will give what you mentioned a try Cerberus. Once I get the
> connection going I am intending to try to get sql server and other
> database connection to read the server details of a say sql.ini file
> (for Sybase) and read the user and password of a login/pword textbox.
>
> But I think that's way too advanced for me now. :p
> Oh and thanks for explanining OP.
>
[DotNetDevelopment] Re: Getting type of exception
Evaluate what the "ex" parameter holds and that would mean
declaring/anticipating what particular Exceptions might be thrown to
it like:
public void HandleException(Exception ex)
{
if ( (ex as MissingDependencyException ) != null) //
MissingDependencyException raised?
{
...do
stuff... // ..
then handle it...
}
if ( (ex as DividebyzeroException ) != null) //
DivideByZeroException raised?
{
...do different
stuff... // then handle
like...
}
// other possible exceptions define them here...
}
Regards,
Benj
On May 29, 6:10 am, rbr <ryankbr...@gmail.com> wrote:
> Hello all,
>
> I am tasked with creating a base exception handler that will handle a
> bunch of clean-up that needs to happen based on the type of exception
> thrown. So, for example, I will have (at least in my initial thoughts)
> a base class like:
>
> public abstract class BaseExceptionHandler
> {
>
> public void HandleException(Exception ex)
> {
> Do something based on exception type;
> }
>
> }
>
> Then each inherited exception type will declare like:
>
> public abstract class NewExceptionHandler : BaseExceptionHandler
> {
>
> Any new or overridden logic
>
> }
>
> Then the implementation needs to look like:
>
> NewExceptionHandler exHandler = new NewExceptionHandler();
>
> try
> {
> Whatever}
>
> catch (MissingDependencyException ex)
> {
> exHandler.HandleException(ex);}
>
> catch (DividebyzeroException ex)
> {
> exHandler.HandleException(ex);}
>
> …
> How, given that all of these inherit from Sytem.Exception do I find
> out the actual type of the exception thrown? I know I am missing
> something obvious…
>
> Thanks in advance!
>
> rbr
[DotNetDevelopment] Re: (C#) How to enable or disable Menu Strip in another form
1) A class needs to be instantiated with "new", but was not done so.
or
2) A class has been instantiated BUT you assigned Nothing (VB) or null
(C#) to it,
and then you attempted to use the methods from it.
Kindly look at the code again.
Cheers!
Benj
On May 28, 5:04 pm, sahm <sahm...@gmail.com> wrote:
> Hi every one
>
> Good Day
>
> I still get this error
> /////////////////////////////////////
> Object reference not set to an instance of an object
> \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> Best
>
> Salim
>
> On May 18, 4:28 am, CallMeLaNN <nalz...@gmail.com> wrote:
>
> > I thought you want to use MDI for login form.
>
> > If so, you need to add log.MdiParent = this; here:
>
> > Login log = new Login();
> > log.MdiParent = this;
> > log.Show();
>
> > Note: to make your login visible, place the checkUser(); not in
> > "public Main()" constructor but in Main_Load().
>
> > The "Object reference not set to an instance of an object" is because
> > of your
> > ParentForm or this.MdiParent is null at here:
>
> > Main ParentForm = (Main)this.MdiParent;
>
> > and sure will throw the error when you use it:
> > ParentForm.menuStrip1.Enabled = false;
>
> > On May 17, 2:10 pm, sahm <sahm...@gmail.com> wrote:
>
> > > Hi every One
>
> > > Good Day
>
> > > I'm still having problem with this
> > > I write the code like this
>
> > > ////////////////////////////////////
> > > Login log = new Login(this);
> > > log.ShowDialog();
> > > \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> > > this error is showing
> > > ///////////////////////////////////////
> > > Error 1 'Archive_System.Login' does not contain a constructor that
> > > takes '1' arguments E:\Projects\C#\Archive System\Archive System
> > > \MainForm.cs 68 25 Archive System
>
> > > \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> > > and if I writ is like this
> > > //////////////////////////////
> > > Login log = new Login();
> > > log.ShowDialog(this);
> > > \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> > > Run time error is showing after I Enter the user name and the password
> > > ///////////////////////////////////
> > > Object reference not set to an instance of an object
> > > \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> > > and this is my code
>
> > > MainForm
> > > /////////////////////////////////////
> > > using System;
> > > using System.Collections.Generic;
> > > using System.ComponentModel;
> > > using System.Data;
> > > using System.Drawing;
> > > using System.Linq;
> > > using System.Text;
> > > using System.Windows.Forms;
> > > using System.Management;
>
> > > namespace Archive_System
> > > {
> > > public partial class Main : Form
> > > {
> > > public Main()
> > > {
> > > try
> > > {
> > > InitializeComponent();
> > > this.WindowState = FormWindowState.Maximized;
> > > this.FormBorderStyle = FormBorderStyle.FixedSingle;
> > > this.Closing += new CancelEventHandler(Form_Closing);
>
> > > this.menuStrip1.Enabled = false;
> > > //this.Enabled = false;
> > > checkUser();
> > > }
> > > catch (Exception exp)
> > > {
> > > string ms = exp.Message;
> > > MessageBox.Show(this, ms, "System Error",
> > > MessageBoxButtons.OK, MessageBoxIcon.Error);
>
> > > }
> > > }
>
> > > System.Data.SqlClient.SqlConnection con;
>
> > > private void userToolStripMenuItem_Click(object sender,
> > > EventArgs e)
> > > {
> > > try
> > > {
> > > createUser cu = new createUser();
> > > cu.MdiParent = this;
> > > cu.Show();
>
> > > }
> > > catch (Exception exp)
> > > {
> > > string ms = exp.Message;
> > > MessageBox.Show(this, ms, "System Error",
> > > MessageBoxButtons.OK, MessageBoxIcon.Error);
> > > }
> > > }
>
> > > private void aboutToolStripMenuItem_Click(object sender,
> > > EventArgs e)
> > > {
> > > About ab = new About();
> > > ab.MdiParent = this;
> > > ab.Show();
> > > }
> > > /*public void setPreviousForm(frmMain mainFrm)
> > > {
> > > prevForm = mainForm;
> > > }*/
> > > public void checkUser()
> > > {
> > > Login log = new Login();
> > > //log.setPreviousForm(this);
> > > log.ShowDialog(this);
>
> > > }
>
> > > private void Main_Load(object sender, EventArgs e)
> > > {
> > > con = new System.Data.SqlClient.SqlConnection();
> > > con.ConnectionString = "Data Source=mr-x\
> > > \SQLExpress2008;Initial Catalog=archive;Integrated Security=True";
> > > con.Open();
>
> > > }
>
> > > public void Form_Closing(object sender, CancelEventArgs cArgs)
> > > {
> > > con.Close();
>
> > > }
>
> > > private void menuStrip1_ItemClicked(object sender,
> > > ToolStripItemClickedEventArgs e)
> > > {
>
> > > }
>
> > > }}
>
> > > \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> > > Login
> > > /////////////////////////////////////
> > > using System;
> > > using System.Collections.Generic;
> > > using System.ComponentModel;
> > > using System.Data;
> > > using System.Drawing;
> > > using System.Linq;
> > > using System.Text;
> > > using System.Windows.Forms;
>
> > > namespace Archive_System
> > > {
> > > public partial class Login : Form
> > > {
> > > public Login()
> > > {
> > > InitializeComponent();
> > > }
> > > //private static new MainForm ParentForm = null;
>
> > > /*public Login(MainForm APrent):this()
> > > {
> > > Main ParentForm =(Main) this.MdiParent;
> > > }*/
>
> > > private void OKbutton_Click(object sender, EventArgs e)
> > > {
> > > string un = userNametextBox.Text;
> > > string ps = PasswardMaskedTextBox.Text;
>
> > > if (un == "sahm" || ps == "java")
> > > {
> > > MessageBox.Show(this, "Login Work", "",
> > > MessageBoxButtons.OK, MessageBoxIcon.Information);
> > > //ParentForm.menuStrip1.Enabled = !
> > > ParentForm.menuStrip1.Enabled;
> > > Main ParentForm = (Main)this.MdiParent;
> > > ParentForm.menuStrip1.Enabled = false;
>
> > > }
> > > else
> > > {
> > > MessageBox.Show(this, "Login not work", "",
> > > MessageBoxButtons.OK, MessageBoxIcon.Information);
> > > }
>
> > > }
>
> > > private void CancelButton_Click(object sender, EventArgs e)
> > > {
> > > this.Close();
> > > }
>
> > > }}
>
> > > \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> > > Thank every one
>
> > > Best
>
> > > Salim
>
> > > On May 16, 10:45 am, sahm <sahm...@gmail.com> wrote:
>
> > > > Hi CallMeLann
>
> > > > Thank for your help I'll try this
>
> > > > Best
> > > > Salim
>
> > > > On May 15, 11:23 am, CallMeLaNN <nalz...@gmail.com> wrote:
>
> > > > > Because you use:
>
> > > > > Login log = new Login();
>
> > > > > In MainForm but you declare:
>
> > > > > public Login(MainForm APrent):this()
>
> > > > > Which LoginForm need APrent value that is MainForm.
> > > > > To solve change to this:
>
> > > > > Login log = new Login(this);
>
> > > > > But, I recommend u to use MdiParent instead.
>
> > > > > 1. Remove the "private static new MainForm ParentForm = null;" no need
> > > > > to use this.
> > > > > 2. login constructor: let it default constructor (no parameter):
> > > > > "public Login()"
> > > > > 3. To disable the menu use like this: (Im not sure your main form type
> > > > > is Main or MainForm based on your code, I assume Main)
>
> > > > > Main ParentForm = (Main) this.MdiParent
> > > > > ParentForm.menuStrip1.Enabled = False
>
> > > > > dont use ! for toggle it, it can be wrong toggle, instead, assign true
> > > > > or false if you sure.
>
> > > > > On May 14, 4:01 pm, sahm <sahm...@gmail.com> wrote:
>
> > > > > > Hi Benj Nunez
>
> > > > > > Good Day
>
> > > > > > I try to do that but some error show up
> > > > > > and this is my code
>
> > > > > > the child form
> > > > > > ////////////////////////////////////////////////////
>
> > > > > > using System;
> > > > > > using System.Collections.Generic;
> > > > > > using System.ComponentModel;
> > > > > > using System.Data;
> > > > > > using System.Drawing;
> > > > > > using System.Linq;
> > > > > > using System.Text;
> > > > > > using System.Windows.Forms;
>
> > > > > > namespace Archive_System
> > > > > > {
> > > > > > public partial class Login : Form
> > > > > > {
> > > > > > public Login()
> > > > > > {
> > > > > > InitializeComponent();
> > > > > > }
> > > > > > private static new MainForm ParentForm = null;
>
> > > > > > public Login(MainForm APrent):this()
> > > > > > {
> > > > > > ParentForm = APrent;
> > > > > > }
>
> > > > > > private void OKbutton_Click(object sender, EventArgs e)
> > > > > > {
> > > > > > string un = userNametextBox.Text;
> > > > > > string ps = PasswardMaskedTextBox.Text;
>
> > > > > > if (un == "sahm" || ps == "java")
> > > > > > {
> > > > > > MessageBox.Show(this, "Login Work", "",
> > > > > > MessageBoxButtons.OK, MessageBoxIcon.Information);
> > > > > > ParentForm.menuStrip1.Enabled = !
> > > > > > ParentForm.menuStrip1.Enabled;
>
> > > > > > }
> > > > > >
>
> ...
>
> read more »
[DotNetDevelopment] Re: connecting to database
Thanks for the info. The SQL server is setup for windows
authentication. I am trying this method currently just so I can get
the connection to the db step done - as mentioned I am very raw to all
this and not much of a programmer really (but I am finding it
enjoyable - with good help obviously :D)
I will give what you mentioned a try Cerberus. Once I get the
connection going I am intending to try to get sql server and other
database connection to read the server details of a say sql.ini file
(for Sybase) and read the user and password of a login/pword textbox.
But I think that's way too advanced for me now. :p
Oh and thanks for explanining OP.
On May 29, 4:23 am, Cerebrus <zorg...@sify.com> wrote:
> Not necessarily. The OP is using the connection string type used in
> Windows integrated authentication (SQL server Trusted connections).
> Such connections do not require a username-password combo.
>
> This may prove to be the cause of the problem but only if the OP's SQL
> server instance is not configured for Windows authentication. There is
> nothing wrong with the connection string per se.
>
> On May 28, 10:45 am, Naveen Kumar <dotnetguru2...@gmail.com> wrote:
>
> > Hi,
>
> > U must Know there are few things When U are connecting to SqlServer as
> > DataBase support.
>
> > when u are using sqlclient in VS 2005 then four parameter are Required.
>
> > - Server - mean U have to provide Server name in case of ur own
> > computer is localhost then put . or computername.
> > - initial catalog - is Database name. like pubs or northwind i sql
> > server.
> > - UID - is Username for sql server connectivity.
> > - PWD - is Password for sql server connectivity.
>
> > then ur connection string is look like "server=.;initial
> > catalog=dbname;UID=username;PWD=password;"
>
> > Try this.
>
> > On 5/27/09, The_Fruitman <evilfruitsmas...@gmail.com> wrote:
>
> > > Here's an example of the flow that you need to do. NOTE: This was
> > > written very quickly and there is room for refactoring and cleaning up
> > > the functions as well as adding error handling but the basic principal
> > > is what I'm trying to get across. For this example I'm going to throw
> > > the results into a dataset.
>
> > > Private Sub login_button_Click(ByVal sender As System.Object,
> > > ByVal e As System.EventArgs) Handles login_button.Click
>
> > > Dim sqlconn As SqlConnection
> > > Dim sqldata As SqlDataAdapter
> > > Dim dsresults As New DataSet
> > > Dim strsql As String = "Select * From table"
>
> > > sqlconn = New SqlConnection("PUT YOUR CONNECTION STRING HERE")
> > > sqldata = New SqlDataAdapter(strsql, sqlconn)
> > > sqlconn.Open()
> > > sqldata.Fill(dsresults)
> > > sqlconn.Close()
>
> > > End Sub
>
> > > On May 26, 5:56 pm, jt_2009 <jth...@gmail.com> wrote:
> > > > HI everyone,
>
> > > > Thank you for all the info and the welcome. Couple of things:
>
> > > > 1. What is OP?
> > > > 2. I understand that the logic/concept is the same. However where I am
> > > > stuck is in the application of this concept.
>
> > > > As you can see from the above I've since attempted to do the following
> > > > when the button is clicked:
> > > > a. open a connection to sybase (using the connection string from the
> > > > connection string website)
> > > > b. I've also imported System.Data.Oledb
>
> > > > However this is still not working. I have tried connecting to a MSSQL
> > > > server instead (just easier for me as I am learning). I can add a data
> > > > source in VS2005 BUT I still have no idea on how to get the connection
> > > > to be established when the button is clicked. I must definitely be
> > > > missing something.
>
> > > > So if you would be able to assist me in this particular area that
> > > > would be great. Even helping me get the MSSQL connectivity working
> > > > upon clicking the login buttong would be a good start - I can then
> > > > apply the same thing to connect to say sybase.
>
> > > > At this stage though I need someone to take my hand and walk me
> > > > through (unfortunately). Once again I understand the concept is the
> > > > same no matter what db/type of app but practically speaking I can't
> > > > get it working.
>
> > > > Thanks again for your time.
>
> > > > On May 22, 5:32 pm, Cerebrus <zorg...@sify.com> wrote:
>
> > > > > Correct, but the OP is referring to Login suite of controls which are
> > > > > exclusively ASP.NET. Clearly, it was a lapse on the part of the OP not
> > > > > to mention the type of application at the outset.
>
> > > > > BTW, Welcome to the Group! ;-)
>
> > > > > On May 22, 1:33 am, Neo <ankit.gameprogram...@gmail.com> wrote:
>
> > > > > > dude,
> > > > > > even if u are developing a window app (.exe), the logic behind the
> > > > > > authentication remains the same,
> > > > > > i.e. :
> > > > > > if the user name and password exists in db,
> > > > > > load them in your app, using ADO.NET and compare it with the user
> > > > > > input. simple :)
>
> > > > > > On May 20, 6:35 am, jt_2009 <jth...@gmail.com> wrote:
>
> > > > > > > Hi Keidrick
>
> > > > > > > Thank you for your reply, but I think the login control is for web
> > > > > > > based applications? I am building an exe - please correct me if I
> > > am
> > > > > > > wrong.
>
> > > > > > > On May 20, 12:04 am, KeidrickP <keidri...@gmail.com> wrote:
>
> > > > > > > > I would also recommend using the .net login controls.
> > > > > > > > Instead of just regular text boxes.
>
> > > > > > > >http://msdn.microsoft.com/en-us/library/ms178329.aspx
>
> > > > > > > > On Tue, May 19, 2009 at 8:50 AM, The_Fruitman
>
> > > > > > > > <evilfruitsmas...@gmail.com> wrote:
>
> > > > > > > > > The programming logic remains the same no matter what database
> > > you're
> > > > > > > > > connecting to.
>
> > >http://www.google.com/search?hl=en&q=connect+to+database+in+vb.net&aq...
>
> > > > > > > > > The connection string can be found here:
> > > > > > > > >http://connectionstrings.com/sybase-adaptive
>
> > > > > > > > > On May 18, 11:04 pm, jt_2009 <jth...@gmail.com> wrote:
> > > > > > > > >> Hi I am new to vb.net.
>
> > > > > > > > >> I am creating a login form and require the form to validate
> > > the
> > > > > > > > >> username and password from a sybase ASE database. I was
> > > wondering if
> > > > > > > > >> anyone here knows how to do that?
>
> > > > > > > > >> Thank you . I am doing this using VS 2005.
>
> > > > > > > > --
> > > > > > > > Keidrick Pettaway
>
> > > > > > > >http://kpettaway.com-Hidequotedtext-
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
[DotNetDevelopment] Getting type of exception
I am tasked with creating a base exception handler that will handle a
bunch of clean-up that needs to happen based on the type of exception
thrown. So, for example, I will have (at least in my initial thoughts)
a base class like:
public abstract class BaseExceptionHandler
{
public void HandleException(Exception ex)
{
Do something based on exception type;
}
}
Then each inherited exception type will declare like:
public abstract class NewExceptionHandler : BaseExceptionHandler
{
Any new or overridden logic
}
Then the implementation needs to look like:
NewExceptionHandler exHandler = new NewExceptionHandler();
try
{
Whatever
}
catch (MissingDependencyException ex)
{
exHandler.HandleException(ex);
}
catch (DividebyzeroException ex)
{
exHandler.HandleException(ex);
}
…
How, given that all of these inherit from Sytem.Exception do I find
out the actual type of the exception thrown? I know I am missing
something obvious…
Thanks in advance!
rbr
[DotNetDevelopment] Re: Problem with a namespace...
On May 28, 9:29 pm, The_Fruitman <evilfruitsmas...@gmail.com> wrote:
> The sample code you found is missing some additional sample code. The
> TestSignature.Utils is not a part of the .NET framework. You will
> need to go back to whereever you got the sample code and see if there
> are additional code samples (something that may have a namespace
> declaration at the top of TestSignature.Utils). It may also be
> available as a compiled DLL that you need to add a reference to.
> Without knowing where you got this sample piece of code it is
> difficult to provide you with an answer.
>
> On May 28, 6:35 am, mypicturefaded <ctayl...@gmail.com> wrote:
>
>
>
> > I cannot find the correct reference to one piece of code I have. This
> > is some sample code I found, and I need to build on it. What reference
> > do I need to add to make this work??
>
> > Here is a code snippet:
>
> > namespace TestSignature
> > {
> > using System;
> > using System.Diagnostics;
> > using System.Drawing;
> > using System.IO;
> > using System.Reflection;
> > using System.Security.Cryptography;
> > using System.Security.Cryptography.X509Certificates;
> > using System.Security.Cryptography.Xml;
> > using System.Text;
> > using System.Windows.Forms;
> > using System.Xml;
>
> > using Extensibility;
> > using Microsoft.Office.Core;
> > using stdole;
>
> > using TestSignature.Utils;
>
> > using XmlDataObject = System.Security.Cryptography.Xml.DataObject;
>
> > I get the error at using TestSignature.Utils;
> > If I comment the line out, some of the code losses functionality.
> > What needs to be added?- Hide quoted text -
>
> - Show quoted text -
[DotNetDevelopment] Re: XmlDocument .Load response times
opinion, you are clubbing the problem of the XmlDocument class loading
an Xml file from a stream and the problem of the response time taken
to retrieve that entire stream from the network resource.
Try loading the file after saving it locally. How much time does it
take then ? You will have isolated the cause of the problem.
On May 27, 6:58 pm, bbbs <bbbs.b...@gmail.com> wrote:
> I am writing my first code to parse an XML response obtained from a
> HTML GET response.
>
> The code is very simple :
>
> // Create a new XmlDocument
> XmlDocument doc = new XmlDocument();
>
> // Load data
> doc.Load("http://clad01/api/v1/company/list/
> 521826-440382-681782");
>
> The code is fine in that it beings back the data and I can navigate
> the XML structure fine. The problem is the response time, it takes
> 30-40 seconds for the "doc.Load" call to execute.
>
> The XML document being returned is very small approx 300-400bytes, and
> the webserver is a local Apache instance on the same machine. If I
> access the URL via a browser the response is instantaneous.
>
> Any ideas on what I can do to speed this up? Is there a better way of
> doing this?
>
> thanks
> RK
[DotNetDevelopment] Re: Return XML string as an output in Web service
will need to be encoded. .NET understands this and does this encoding
automatically.
Is your client so antiquated that they cannot decode an encoded XML
string ??
On May 28, 1:17 am, Arjun Priyananth <priyanan...@gmail.com> wrote:
> Hi,
>
> I am writing a webservice which returns xml string as an output.
>
> When this service returns the soap message, it replaces all "<" and ">"
> symbols to "lt;" "gt;" symbols in the xml string.
>
> This works fine if its webreferenced in IDE. But due to leagacy client
> requirments I need to get only soap messages using web request and response.
> Any solutions pls
>
> -Aj
[DotNetDevelopment] Re: Database connection efficiency
examples of code in this thread is where the handling of exceptions is
done. The other item you may want to verify for efficiency is the
stored procedure code. Can the result set be refined at all and still
allow your code to function correctly? Do you need everything that the
stored procedure returns?
On May 28, 11:43 am, Cerebrus <zorg...@sify.com> wrote:
> Alright, here's my opinion:
>
> The "Using" construct is functionally equivalent to a Try-Finally
> construct. It is a developer convenience and the compiler will convert
> the former to the latter. So, there is no difference in performance in
> the two. However, the Try-Finally construct does not provide for a
> structured way to handle exceptions (it omits the Catch block and all
> exceptions are bubbled up to the calling code. This is the point you
> need to consider... Does your code require all exceptions to be
> handled here itself ? If so, you will have to refactor into Try-Catch-
> Finally constructs. If not, you're good with using Using ! (pun
> intended)
>
> The code you presented is very well formed. It is hard to be more
> efficient except for a single point that I noticed - You open the
> Connection early on. For highest performance, you should open your
> Connection as late as possible and dispose of it as soon as possible.
>
> IOW, the Connection.Open() call should be just before the
> SqlDataReader is created.
>
> On May 27, 3:01 pm, Chris Marks <chris.ma...@gmail.com> wrote:
>
>
>
> > I've posted this on a couple forums, but in order to gain a wider
> > audience, and possible responses I thought i'd post it here too!
>
> > I normally connect to a database as follows:
>
> > using (SqlConnection connection = new SqlConnection
> > ("connectionString"))
> > {
> > connection.Open();
> > using (SqlCommand command = new SqlComamnd
> > ("storedProc",connection))
> > {
> > command.CommandType = CommandType.StoredProcedure;
> > command.Parameters.AddWithValue("@P1",Value);
> > using (SqlDataReader reader = command.ExecuteReader())
> > {
> > if (reader.HasRows)
> > {
> > reader.Read();
> > // rest of code to populate tables, etc here
> > }
> > }
> > }
>
> > }
>
> > However, shortly I'm going from typically serving say 200 users, to
> > more like 60,000 users, and as such I'd like to ensure that I'm doing
> > everything I can to create efficient code. I've been looking at other
> > examples, using the "try/catch/finally" methods, but further reading
> > supports using "using" more so, due to the fact that it will always
> > clean up.
>
> > With regard to trapping errors in the commands/connections - should I
> > be using a try/catch/finally block within my "using" blocks?
>
> > TIA!
>
> > Chris
>
> > Thanks!- Hide quoted text -
>
> - Show quoted text -
[DotNetDevelopment] Re: connecting to database
Windows integrated authentication (SQL server Trusted connections).
Such connections do not require a username-password combo.
This may prove to be the cause of the problem but only if the OP's SQL
server instance is not configured for Windows authentication. There is
nothing wrong with the connection string per se.
On May 28, 10:45 am, Naveen Kumar <dotnetguru2...@gmail.com> wrote:
> Hi,
>
> U must Know there are few things When U are connecting to SqlServer as
> DataBase support.
>
> when u are using sqlclient in VS 2005 then four parameter are Required.
>
> - Server - mean U have to provide Server name in case of ur own
> computer is localhost then put . or computername.
> - initial catalog - is Database name. like pubs or northwind i sql
> server.
> - UID - is Username for sql server connectivity.
> - PWD - is Password for sql server connectivity.
>
> then ur connection string is look like "server=.;initial
> catalog=dbname;UID=username;PWD=password;"
>
> Try this.
>
> On 5/27/09, The_Fruitman <evilfruitsmas...@gmail.com> wrote:
>
>
>
>
>
> > Here's an example of the flow that you need to do. NOTE: This was
> > written very quickly and there is room for refactoring and cleaning up
> > the functions as well as adding error handling but the basic principal
> > is what I'm trying to get across. For this example I'm going to throw
> > the results into a dataset.
>
> > Private Sub login_button_Click(ByVal sender As System.Object,
> > ByVal e As System.EventArgs) Handles login_button.Click
>
> > Dim sqlconn As SqlConnection
> > Dim sqldata As SqlDataAdapter
> > Dim dsresults As New DataSet
> > Dim strsql As String = "Select * From table"
>
> > sqlconn = New SqlConnection("PUT YOUR CONNECTION STRING HERE")
> > sqldata = New SqlDataAdapter(strsql, sqlconn)
> > sqlconn.Open()
> > sqldata.Fill(dsresults)
> > sqlconn.Close()
>
> > End Sub
>
> > On May 26, 5:56 pm, jt_2009 <jth...@gmail.com> wrote:
> > > HI everyone,
>
> > > Thank you for all the info and the welcome. Couple of things:
>
> > > 1. What is OP?
> > > 2. I understand that the logic/concept is the same. However where I am
> > > stuck is in the application of this concept.
>
> > > As you can see from the above I've since attempted to do the following
> > > when the button is clicked:
> > > a. open a connection to sybase (using the connection string from the
> > > connection string website)
> > > b. I've also imported System.Data.Oledb
>
> > > However this is still not working. I have tried connecting to a MSSQL
> > > server instead (just easier for me as I am learning). I can add a data
> > > source in VS2005 BUT I still have no idea on how to get the connection
> > > to be established when the button is clicked. I must definitely be
> > > missing something.
>
> > > So if you would be able to assist me in this particular area that
> > > would be great. Even helping me get the MSSQL connectivity working
> > > upon clicking the login buttong would be a good start - I can then
> > > apply the same thing to connect to say sybase.
>
> > > At this stage though I need someone to take my hand and walk me
> > > through (unfortunately). Once again I understand the concept is the
> > > same no matter what db/type of app but practically speaking I can't
> > > get it working.
>
> > > Thanks again for your time.
>
> > > On May 22, 5:32 pm, Cerebrus <zorg...@sify.com> wrote:
>
> > > > Correct, but the OP is referring to Login suite of controls which are
> > > > exclusively ASP.NET. Clearly, it was a lapse on the part of the OP not
> > > > to mention the type of application at the outset.
>
> > > > BTW, Welcome to the Group! ;-)
>
> > > > On May 22, 1:33 am, Neo <ankit.gameprogram...@gmail.com> wrote:
>
> > > > > dude,
> > > > > even if u are developing a window app (.exe), the logic behind the
> > > > > authentication remains the same,
> > > > > i.e. :
> > > > > if the user name and password exists in db,
> > > > > load them in your app, using ADO.NET and compare it with the user
> > > > > input. simple :)
>
> > > > > On May 20, 6:35 am, jt_2009 <jth...@gmail.com> wrote:
>
> > > > > > Hi Keidrick
>
> > > > > > Thank you for your reply, but I think the login control is for web
> > > > > > based applications? I am building an exe - please correct me if I
> > am
> > > > > > wrong.
>
> > > > > > On May 20, 12:04 am, KeidrickP <keidri...@gmail.com> wrote:
>
> > > > > > > I would also recommend using the .net login controls.
> > > > > > > Instead of just regular text boxes.
>
> > > > > > >http://msdn.microsoft.com/en-us/library/ms178329.aspx
>
> > > > > > > On Tue, May 19, 2009 at 8:50 AM, The_Fruitman
>
> > > > > > > <evilfruitsmas...@gmail.com> wrote:
>
> > > > > > > > The programming logic remains the same no matter what database
> > you're
> > > > > > > > connecting to.
>
> >http://www.google.com/search?hl=en&q=connect+to+database+in+vb.net&aq...
>
> > > > > > > > The connection string can be found here:
> > > > > > > >http://connectionstrings.com/sybase-adaptive
>
> > > > > > > > On May 18, 11:04 pm, jt_2009 <jth...@gmail.com> wrote:
> > > > > > > >> Hi I am new to vb.net.
>
> > > > > > > >> I am creating a login form and require the form to validate
> > the
> > > > > > > >> username and password from a sybase ASE database. I was
> > wondering if
> > > > > > > >> anyone here knows how to do that?
>
> > > > > > > >> Thank you . I am doing this using VS 2005.
>
> > > > > > > --
> > > > > > > Keidrick Pettaway
>
> > > > > > >http://kpettaway.com-Hidequotedtext-
>
> > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
[DotNetDevelopment] Re: connecting to database
permissions to create an OleDbConnection. Things to look into :
- Is your code running from a shared network drive ? Such code never
runs with full trust (pre-.NET 4.0). Also look at the Trust settings
of your project. (http://msdn.microsoft.com/en-us/library/
wyts434y.aspx)
- Try creating an SqlConnection instead of an OleDbConnection.
- Is your SQL server instance configured to use Windows
authentication? Because the connection string you are using mandates
such a configuration to be set at the SQL Server.
On May 28, 10:10 am, jt_2009 <jth...@gmail.com> wrote:
> Hi Thank you cerberus and fruitman.
>
> I've done the following:
>
> Private Sub login_button_Click(ByVal sender As System.Object,
> ByVal e As System.EventArgs) Handles login_button.Click
>
> Dim strConnectionString As String = "Provider=SQLOLEDB;Data
> Source=SQLSERVER;Integrated Security=SSPI"
> Dim objConnection As New OleDbConnection(strConnectionString)
>
> objConnection.Open()
>
> but I get the following error at this point:
>
> An unhandled exception of type 'System.Security.SecurityException'
> occurred in System.Data.dll
>
> Additional information: Request for the permission of type
> 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
>
Thursday, May 28, 2009
[DotNetDevelopment] Re: Confirm Dialog Box in ASP.net
and property name to be available in client side Javascript.
I'm guessing that "ctlGridView" is the ID of your control. GridViews
are rendered on the client as HTML tables... a browser does not know
of anything called a GridView. In the same vein, the EditIndex
property is a server side property of the GridView. Even if you would
retrieve a reference to the client side HTML table rendered by your
GridView, you would not find any property named "EditIndex" in that
object.
So, the value is not being set because the browser does not know what
ctlGridView is and cannot try to lookup a property named EditIndex of
that undefined object.
... and that's that !
On May 28, 6:21 pm, "ASP.Net" <abc123xyz9...@gmail.com> wrote:
> i am trying this:
> Page.RegisterStartupScript(" ", " <script > if (confirm('You will lose
> all the changes if not saved')==true){ ctlGridView.EditIndex = " +
> e.NewEditIndex + ";} </script > ");
>
> can anyone tell me why "ctlGridView.EditIndex =" is not getting the
> value at runtime.
[DotNetDevelopment] Re: Database connection efficiency
The "Using" construct is functionally equivalent to a Try-Finally
construct. It is a developer convenience and the compiler will convert
the former to the latter. So, there is no difference in performance in
the two. However, the Try-Finally construct does not provide for a
structured way to handle exceptions (it omits the Catch block and all
exceptions are bubbled up to the calling code. This is the point you
need to consider... Does your code require all exceptions to be
handled here itself ? If so, you will have to refactor into Try-Catch-
Finally constructs. If not, you're good with using Using ! (pun
intended)
The code you presented is very well formed. It is hard to be more
efficient except for a single point that I noticed - You open the
Connection early on. For highest performance, you should open your
Connection as late as possible and dispose of it as soon as possible.
IOW, the Connection.Open() call should be just before the
SqlDataReader is created.
On May 27, 3:01 pm, Chris Marks <chris.ma...@gmail.com> wrote:
> I've posted this on a couple forums, but in order to gain a wider
> audience, and possible responses I thought i'd post it here too!
>
> I normally connect to a database as follows:
>
> using (SqlConnection connection = new SqlConnection
> ("connectionString"))
> {
> connection.Open();
> using (SqlCommand command = new SqlComamnd
> ("storedProc",connection))
> {
> command.CommandType = CommandType.StoredProcedure;
> command.Parameters.AddWithValue("@P1",Value);
> using (SqlDataReader reader = command.ExecuteReader())
> {
> if (reader.HasRows)
> {
> reader.Read();
> // rest of code to populate tables, etc here
> }
> }
> }
>
> }
>
> However, shortly I'm going from typically serving say 200 users, to
> more like 60,000 users, and as such I'd like to ensure that I'm doing
> everything I can to create efficient code. I've been looking at other
> examples, using the "try/catch/finally" methods, but further reading
> supports using "using" more so, due to the fact that it will always
> clean up.
>
> With regard to trapping errors in the commands/connections - should I
> be using a try/catch/finally block within my "using" blocks?
>
> TIA!
>
> Chris
>
> Thanks!
[DotNetDevelopment] Re: Problem with a namespace...
TestSignature.Utils is not a part of the .NET framework. You will
need to go back to whereever you got the sample code and see if there
are additional code samples (something that may have a namespace
declaration at the top of TestSignature.Utils). It may also be
available as a compiled DLL that you need to add a reference to.
Without knowing where you got this sample piece of code it is
difficult to provide you with an answer.
On May 28, 6:35 am, mypicturefaded <ctayl...@gmail.com> wrote:
> I cannot find the correct reference to one piece of code I have. This
> is some sample code I found, and I need to build on it. What reference
> do I need to add to make this work??
>
> Here is a code snippet:
>
> namespace TestSignature
> {
> using System;
> using System.Diagnostics;
> using System.Drawing;
> using System.IO;
> using System.Reflection;
> using System.Security.Cryptography;
> using System.Security.Cryptography.X509Certificates;
> using System.Security.Cryptography.Xml;
> using System.Text;
> using System.Windows.Forms;
> using System.Xml;
>
> using Extensibility;
> using Microsoft.Office.Core;
> using stdole;
>
> using TestSignature.Utils;
>
> using XmlDataObject = System.Security.Cryptography.Xml.DataObject;
>
> I get the error at using TestSignature.Utils;
> If I comment the line out, some of the code losses functionality.
> What needs to be added?
[DotNetDevelopment] Re: http post
an HTTP 500 error. I found some information about adding a line in
web.config to allow HTTP Post as opposed to SOAP, but that didn't seem
to lead anywhere. Did you have to do anything like that? Also what
does your web method look like. Is it something like this?
[WebMethod]
public string PostXML(Stream fileByteStream)
{
if (Process(fileByteStream))
{
return "OK";
}
else
{
return "Fail";
}
Thanks again, Rico
On May 28, 3:50 am, "tha. NIVAS" <mdni...@gmail.com> wrote:
> Hi Rico,
>
> This is how i implemented the Http post.
>
> String result = string.Empty;
>
> StreamWriter myWriter = null;
>
> string url = ConfigurationManager.AppSettings["Host"];
>
> //Creating a WebRequest
>
> HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
>
> httpWebRequest.Method = "POST";
>
> httpWebRequest.ContentLength = xmlMessage.Length;
>
> httpWebRequest.ContentType = "text/xml;charset=ISO-8859-1";
>
> httpWebRequest.Headers.Add(HttpRequestHeader.Authorization,
> ConfigurationManager.AppSettings["Authorization"]);
>
> try
>
> {
>
> myWriter = new StreamWriter(httpWebRequest.GetRequestStream());
>
> //Writes to the host sever
>
> myWriter.Write(xmlMessage);
>
> }
>
> catch (Exception e)
>
> {
>
> throw e;
>
> }
>
> finally
>
> {
>
> if (myWriter != null)
>
> {
>
> myWriter.Close();
>
> }
> }
>
> //Getting response from host server for our request
>
> HttpWebResponse objResponse = (HttpWebResponse)httpWebRequest.GetResponse();
>
> using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
>
> {
>
> result = sr.ReadToEnd();
>
> // Close and clean up the StreamReader
>
> sr.Close();
>
> }
>
> Regards,
> Nivas
>
>
>
>
>
> On Thu, May 28, 2009 at 11:42 AM, Rico <ericabra...@gmail.com> wrote:
>
> > Hello Nivas,
>
> > I'm trying to do a similar thing. Could you please post your code for
> > the POST and for the web service?
>
> > Thanks,
> > Rico
>
> > On May 26, 11:04 pm, (¯`·._.·NIVAS·._.·´¯) <cdni...@gmail.com> wrote:
> > > Hi Cipto,
>
> > > Thanks for your reply. I have implemented that usin HttpWebRequest and is
> > > done.
> > > Thanks all.
>
> > > On Tue, May 26, 2009 at 8:14 AM, cipto john <ciptoj...@gmail.com> wrote:
> > > > if from javascript
> > > > Use post on xmlhttprequest. set to post and then set your xml as
> > > > string.handle it on server write the string to xml file
>
> > > > if from other type application
> > > > Using FTP would be nice.
>
> > > > of you build your tcp listener accept client bla bla bla
>
> > > > There is nothing to do with ssl, ssl is just encryption.
>
> > > > On Mon, May 25, 2009 at 9:12 PM, ¯`·._.·NIVAS·._.·´¯ <
> > cdni...@gmail.com>wrote:
>
> > > >> Hi Chris,
> > > >> Its not meagre upload file. I have to send xml content as data using
> > http
> > > >> post and inturn another webserver will give response for my request.
>
> > > >> On Fri, May 22, 2009 at 4:54 PM, Chris Marks <chris.ma...@gmail.com
> > >wrote:
>
> > > >>> "Send" ? - perhaps use of a webservice, or if it's just literally to
> > > >>> send/upload a file an XML file to a remote webserver, how about
> > > >>> connecting via FTP?
>
> > > >>> On May 22, 7:38 am, Nivas <cdni...@gmail.com> wrote:
> > > >>> > Hi,
>
> > > >>> > i need to send a xml file to another webserver, which i want to do
> > in
> > > >>> > csharp. how to do this?
> > > >>> > Maybe have to do something with SSLSocket.
>
> > > >>> > Thanks in advance.
>
> > > >> --
> > > >> Tha.Nivas,
> > > >>http://cdnivas.blogspot.com
>
> > > --
> > > Tha.Nivas,http://cdnivas.blogspot.com-Hide quoted text -
>
> > > - Show quoted text -
>
> --
> Regards,
> tha.NIVAS- Hide quoted text -
>
> - Show quoted text -
[DotNetDevelopment] Confirm Dialog Box in ASP.net
Page.RegisterStartupScript(" ", " <script > if (confirm('You will lose
all the changes if not saved')==true){ ctlGridView.EditIndex = " +
e.NewEditIndex + ";} </script > ");
can anyone tell me why "ctlGridView.EditIndex =" is not getting the
value at runtime.
[DotNetDevelopment] Problem with a namespace...
is some sample code I found, and I need to build on it. What reference
do I need to add to make this work??
Here is a code snippet:
namespace TestSignature
{
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Extensibility;
using Microsoft.Office.Core;
using stdole;
using TestSignature.Utils;
using XmlDataObject = System.Security.Cryptography.Xml.DataObject;
I get the error at using TestSignature.Utils;
If I comment the line out, some of the code losses functionality.
What needs to be added?

