|
Hi ,
I am using couple of pages with a master page in asp.net application.
one of the page works fine when i debug the application but when i am debuggifn another page i get the error.
"Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpmodules> section in the application configuration"
Could anyone help me on this.
If i run the application as a published website,it works fine but once i go to debug mode, it shows an error on the line in master page where session["user"] is there.
this error is not shown wnhe debuggin another page of same application.
Regards,
Sama
|
|
|
|
|
Hi
I am using ASP.NET and C#. When I load imgae from the directory mydocuments/mypiactures, it works fine. but when load that image from any other location it gives error. below is the code:
Image1.ImageUrl = "";
bmp = new Bitmap(Upload.PostedFile.FileName);
h = bmp.Height;
w = bmp.Width;
if ((h == 133) && w == 274)
{
int len = Upload.PostedFile.ContentLength;
string imgtype = Upload.PostedFile.ContentType;
string imgtitle = "Logo";
byte[] imgdata = new byte[len];
Upload.PostedFile.InputStream.Read (imgdata, 0, len);
Image1.ImageUrl = Upload.PostedFile.FileName;
//Insert the image and comment into the database
companyDetails.InsertLogo(imgtitle, imgtype, imgdata, 1);
....for example if i load image from desktop it will give error. I think that asp code does not have access to personal files or folders. IF that is the reason then how do we give acces to personal files and folders.
Deepak Anish
Computer Programmer
Maxumise Fiji Ltd
Suva, Fiji
|
|
|
|
|
hi
I want to collapse and expand categories in the property grid.The proeprty grid allows me to expand/collapse all the categories but my requirement is to expand/collapse some categories.
Any suggestions
-- modified at 23:34 Thursday 16th March, 2006
|
|
|
|
|
Could someone please guide me through the working of the 'PropertyTab' property of a propertygrid object. I need to add a page on the toolbar of a propertygrid control for events, similar to the 'events' page on the standard properties floating pane in the Visual Studio .NET IDE.
|
|
|
|
|
Hi,
I have a C# windows application that sends pages of a file to the printer spooler. It is a test tool that should tell me how many pages are spooled at every instance.
I am imagining the test tool to be just like the spooler visible in the system tray with a difference that the tool should have the time stamp of each page spooling. I want to be notified on every page spooling.
Any pointers on how to do it are most welcome.
Thanks,
Roy
|
|
|
|
|
Has anyone had any experience with, or advice on how add named pipe functionality to an otherwise run of the mill C# Windows Form application?
I've got a project to write a utility to interface a special piece of hardware (a custom video camera which has a C# .NET namespace provided by the maker) to another master control program.
The problem is the master program is an old legacy program that only gives remote commands (start, stop, report status, etc.) using named pipes.
I've searched through my C# and .NET references and don't see any namespaces or managed classes to provide named pipe remoting access.
My best guess is somehow import them through the Win32 api functions, but my search efforts so far haven't given me any examples close enough to what I need to really get a good feel for how to go about this.
This was pretty straight forward back in the old VC 6 days using MFC functions, but I don't think they made it to C# yet.
Any advice, recommendations, links or examples would be most welcome (except telling me not to use named pipes or C# .NET, those are the two things I have no control over). Oh, and if it makes any difference (probably makes it worse with my luck) I'm using VS 2003 and .NET 1.1. Having enough fun going from my comfy old VC++ to C# as it is, without having to leap to the changes they made in 2.0 and 2005.
|
|
|
|
|
TCP/IP sent to localhost, uses Named Pipes under the hood I'm told. That's a reasonable swap.
Otherwise you have two basic options. If you want to use Named Pipes in C# for a general mechansism then its off to P/Invoke land. But unless you have to interface to an older C/C++ program that used Named Pipes, you might consider leveraging some of C#'s data structures and particularly the TCP classes.
Secondly, if you are using SQL Server, Microsoft has carried over Named Pipes for that. That's easy to take advantage of.
I guess there is one 3rd option which may or may not make sense. Since you have a heap of code in C++, you could hobble together a C# callable DLL and provide the underlying Named Pipe support.
In sum, Named Pipes appear to have been relegated to performance driven 3GL/2GL apps. With some effort you can force an implementation in C# but you have to ask: "why am I doing this?"
Good luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
mcljava wrote: TCP/IP sent to localhost, uses Named Pipes under the hood I'm told. That's a reasonable swap.
Otherwise you have two basic options. If you want to use Named Pipes in C# for a general mechansism then its off to P/Invoke land. But unless you have to interface to an older C/C++ program that used Named Pipes, you might consider leveraging some of C#'s data structures and particularly the TCP classes.
Secondly, if you are using SQL Server, Microsoft has carried over Named Pipes for that. That's easy to take advantage of.
Yeah, but the trick is figuring out how to use these classes and if they will actually work or not.
I have no control over the other program I'm interfacing with, I just have a pair of named pipes for talking and listening and a list of commands I can expect to receive and replies I need to make.
Whether the TCP classes happen to use pipes or not doesn't mean anything to me. I need to open a specific pipe, wait for a command from another program (which is not of my design or control) and give it a response telling it my status. That program uses named pipes and it's the only hook available for communication.
mcljava wrote: Secondly, if you are using SQL Server, Microsoft has carried over Named Pipes for that. That's easy to take advantage of.
Nope, not using SQL server.
mcljava wrote: With some effort you can force an implementation in C# but you have to ask: "why am I doing this?"
Well, I'm doing it because that's my job...LOL. Unfortunately every time a new technology comes along half the world jumps on the bandwagon thinking it's the next best thing since cake and the other half is relegated to trying to make it work with all the stuff that's been done before. In this example, I have a c# .NET namespace which is the only way to access one piece of hardware, and a named pipe scheme which is the only way to talk to the master program. I'm caught in the middle and have no say in how either one is done.
I really appreciate you giving this one a shot, truly, but I'm afraid I'm left just as confused as to how to accomplish this as I was before.
Anyone know of any books, texts, articles that covers this, or at least dance around the topic enough that I might glean some ideas?
Could there be some way to tap into named pipes using the Win32 API? The Win32 API examples I've seen all look awfully ugly when brought into C# and none even come close to touching on named pipes as far as I can find.
All hints and suggestions welcomed
Phil
|
|
|
|
|
Phil,
Fire up google, and ... "C# named pipes" - it will lead you to at least a dozen or so C# Named Pipe Examples.
Good Luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
Ah whew...I looked again, thanks.
Obviously this was the first thing I did when I first took this on. Perhaps my google skills need polish, I don't know.
Everything I found seemed to be pointed at the new IPC remoting stuff that's in .NET 2.0.
I Found an example on codeguru and it does compile and run with my 1.1, so I'm golden. It's buried inside InterProcessCommunication stuff. I guess since my C++ and MFC experience all had it built into CreateFile and it was right up front and as basic as opening a file I assumed the CSharp would be there too (obviously it isn't)
Thanks for the gentle shove in the right direction
Just what I needed.
|
|
|
|
|
G’Day,
Actually I have a problem with my network program. Can you help me ?.
Actually my laptop is in a WLAN. Means my IP address is local to this LAN. I am developing a client / server software. In this I want to communicate to a P.C in a different network. Eg. My loacl IP is 192.168.0.15 and the other P.C (which I want to communicate to) is 192.168.1.23. But these IPs are there local IPs.
The problem comes in the following code.
private void Form1_Load(object sender, System.EventArgs e)
{
Thread mythread = new Thread(new ThreadStart(serverThread));
mythread.Start();
}
public void serverThread()
{
UdpClient udpClient = new UdpClient(999);
while(true)
{
IPEndPoint RemoteEndPoint = new IPEndPoint(IPAddress.Any,0); // listing for reply
Byte[] receiveBytes = udpClient.Receive(ref RemoteEndPoint);
string returnData = Encoding.ASCII.GetString(receiveBytes);
}
}
private void btnReplay_Click(object sender, System.EventArgs e)
{
string ips = “192.168.0.1.23” ;
UdpClient udpClient = new UdpClient();
udpClient.Connect(ips,999);
Byte[] sendBytes = Encoding.ASCII.GetBytes(“Hi I am testing”); // sending reply
udpClient.Send(sendBytes,sendBytes.Length);
}
The problem is
1. I want to specify the IP address of the destination machine
string ips = “192.168.0.23” ;
Here I iam specifying the local Ip of the machine which is in a different network.
How can I communicate to the destination machine ?
How NAT works ?
Can you guide me in a proper way using c# ?
Thanks in advance
Cheers
|
|
|
|
|
Not sure if this is a direct answer to your problem or not, but are you sure your machine can even see the other one with the way the IP addresses are set up?
In other words, what are the subnet masks on the machine.
If either one is set to the standard 255.255.255.0 these two machines will not be able to see one another regardless of how your program is coded becaues the network mask blocks/prevents all IP traffic except on your local network.
Quick way to test it is to pull up a command prompt on your machine then type:
ping 192.168.1.23...if you get a reply then all should be ok.
By the way, as I was checking back in your message to make sure I typed the right IP address, I notice your program reads:
string ips = “192.168.0.23” ;
Shouldn't that be "192.168.1.23";???????????????
|
|
|
|
|
Thank You. If I ping to 192.168.1.23 . It shows the message " Request timed out". Because it is the local IP of another network. I dont know how to communicate to a client which is in another network ,if I have the global IP of that network. Thank you for your advice
Cheers
Jijo
|
|
|
|
|
Yup, I had a feeling it wsa something along those lines.
You'll probably need more detailed info on the network configuration. For instance is port forwarding enabled, firewalls, etc. I can think of several things that will prevent these two machines from establishing a UDP connection.
You can start by finding out your public IP address by using something like:
http://www.whatismyipaddress.com
Maybe if you run it on both machines you can get a start, but since your machines are probably set to dynamic IP addresses it's going to change each time you reboot either machine.
All I can advise at this point is to use the ping command as you try various settings and addresses. A lot easier than changing your program and re-compiling to find out if the two machines are able to talk to see each other.
|
|
|
|
|
Hi
I have a DB of documents that I want to open/save from a web browser.
I have set the ContentType of my response to be "text/richtext"
and I have Response.BinaryWrite(byte[] mydata)
I get an open/save dialog box like I wanted to, but the file it is asking me to open/save is my asp page...e.g. ResultsPage.aspx.
How come its not asking me to save my document?
Would appreciate any help. been stuck on it for days!
Thanks!
melissa
|
|
|
|
|
I have a .wsdl file and I want to get information from it. I have tried the following:
<br />
[System.Web.Services.Protocols.SoapRpcMethod(<br />
RequestNamespace = "somehttp", <br />
ResponseNamespace = "somehttp")]<br />
[return: System.Xml.Serialization.SoapElementAttribute("return")]<br />
public className get_attr(string username, string password)<br />
{<br />
object[] me = new object[] { username,password };<br />
object[] results = this.Invoke("get_attr",me);<br />
return ((className)(results[0]));<br />
}<br />
Of course, somehttp is a valid http:// address, and get_attr is an operation name inside the .wsdl. When I run this, the "className" object I return is empty (not null, just empty). What would be the simplest way to get information from the .wsdl and also, is C# (without ASP.Net) able to accomplish this. Thanks for all the help.
Mike - I love to program!
-- modified at 17:27 Thursday 16th March, 2006
|
|
|
|
|
I'm trying to make an application that supports plugins but I'm having some troubles with my interface. In the interface I define a function like this:
string edplugin_HandleCommand( string[] command, string username );
And in my test plugin I implement it like this:
public string edplugin_HandleCommand( string[] command, string username )
{
return "Successful!";
}
For some reason when I have the user parameter on the function I get the following error when I try to "load" the plugin with Activator.CreateInstanceFrom() into the main application:
Additional information: Method edplugin_HandleCommand in type edbot.CEDBotPlugin from assembly plugin_test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null does not have an implementation.
When I remove the 2nd parameter from the interface as well as the implementation the program runs flawlessly. Is there some kind of limitation to an interface that won't let me have more than one parameter?
Thanks for the help!
|
|
|
|
|
Your plugin probably was referencing the wrong assembly when building it. TIP: use auto incremented version numbers so you can be sure You can remove it once u have your build proces sorted
|
|
|
|
|
Yup! That was the problem. It was a dumb mistake on my part. I forgot to set the binary path to the place the application was looking for it so it kept trying to load the old assembly that I'd manually copied there. Once I fixed that it works again. Thanks a lot for the help!
-- modified at 9:53 Friday 17th March, 2006
|
|
|
|
|
Does anyone of you can answer to my question?
I want use regular expression in my text box to validate text. For example reg. expression like this : "[0-9][0-9]-[0-9][0-9][0-9]" accepts only for example "43-456" text. What if I enter "54-8f5" ? .NET Regular Expressions tells me that this text is not correct. But it doesn`t tell me which character is invalid.
My problem is that I want .NET Regular Expressions show me which character (which character index in this incorrect string) is invalid.
Please help me...
-- modified at 15:53 Thursday 16th March, 2006
Is it possible with .NET regular expressions?
|
|
|
|
|
No. Sorry. You can only perform positive matching with .NET REs.
|
|
|
|
|
Are you absolutely sure?
Anyway...Thank you very much... You let me safe so much time of my research...
|
|
|
|
|
|
You sugested that in a more difficult regular expression the better thing to do is to write my own regular expression parser?
Do you have any idea how I suppose to do this?
|
|
|
|
|
conrado7 wrote: You sugested that in a more difficult regular expression
I meant an easier RE as per your example. It will probably just be easier to read the string char by char
|
|
|
|