|
Hi,
How can i send qerystring via server.transfer?
i send this from Page1.aspx
<code>Server.Transfer("../../Forms/PersonalWork/Default.aspx?md=Edit&jb=11&stp=1");</code>
wanna to get from Page2.aspx :
<code>string QueryStrings = Request.Url.Query;</code>
|
|
|
|
|
How many questions have you asked in the forums and you still can't work out which one you should post in? Take this to the ASP.NET forum.
|
|
|
|
|
|
And I doubt you are going to get an answer here because you posted this in the wrong forum. What details did you get when you googled for an answer?
|
|
|
|
|
The regular people who answer questions around here are going to answer your question, if posted in the correct forum, on their own time, not yours. Also, if the question doesn't make sense or you are known to be asking basic questions over and over again, you'll probably be ignored because you haven't taken the advice on picking up books and teaching yourself the basics.
People really don't want to write huge forum posts explaining the basics to you if you're not going to make the effort to teach yourself this stuff.
|
|
|
|
|
|
Got my 5 and well said Dave!
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
To understand why it doesn't work, you must first understand how Server.Transfer differs from Response.Redirect. When you do a Server.Transfer, the page processing is shifted to the new page on the Server side and the client is unaware of it as opposed to a Response.Redirect which sends a Resource Moved response to the client and forces it to request the new url. Since Server.Transfer happens on the server side, the Request.Url.Query will always be empty.
|
|
|
|
|
I am dealing with a strange problem when closing a socket connection. I am using an asynchronous receive and I specified, as is MSDN's suggestion, a user-defined object as the last parameter in my BeginReceive(). I expect, as MSDN says, this same object to be passed in the State field of the IAsynchResult parameter of the Callback function I specified in my BeginReceive () call. But , as I close the connection, and the tcp layer as usual sends me a zero-length packet, the Callback function is called but the State field is the Socket native object which received the close and not the usr-defined object I expect.
This seems to be in contrast with MSDN specifications. What am I doing wrong ?
|
|
|
|
|
Hello. I'm Zul from Malaysia. Just asking for your opinion. my place that i do my industrial training asking me to do some project in c# using visual studio 2010 where the application that i develop can monitoring a machine whether is on, off or idle. If machine on, it will show a traffic pictures in green color. If the machine is idle, the application will show traffic in yellow color and if off, it show red color. I not familiar with c# cause i my final project i doing my project using php languange and just doing a web based application only. My programming skill also not a very well. So, where can i get a tutorial or reference to do this project? Can you give me suggestion, where or what should i start first in doing this project? Thank You.
|
|
|
|
|
You are going to have to start by first finding out how the computer is going to know the state of the machine. Does the machine have any ports that can connect to a computer ? If so, what type - USB, Serial or Parallel ? Once you know this, you will have to research what message the machine sends to let you know it's state. Then it is merely a case of monitoring the machine, waiting for the specific messages, and making sure your application reacts accordingly. I will leave it up to you to google for c# traffic light control and code.
Without further information, it is unlikely you will get more specific help than this, I am afraid.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
You haven't identified what type of machine it is. Is it something like a SCADA? How is your application going to connect to it? Is your app going to actually run on the machine? What does it mean by the machine being idle?
Before you even start coding your application, you need to answer questions like these. The most basic skill you can master is being able to properly define the problem that you are trying to solve. If you can't do this, then you won't be able to work out how to code it.
|
|
|
|
|
In addition to the other comments - which are both good, sound advice - change your username!
Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Hello,
I'm having a serious problem and I'm stuck with for three days now. I'm currently developping an add-in for Outlook 2007, and I'm having a toolbar and a menu bar.
The problem is, and I really don't understand why, _CommandBarButtonEvents_ClickEventHandler fires events twice, and sometimes even four times !!
Here is my function where I create the CommandButton elements which will be inserted in menu and tool bars :
public void creationBouton_SubMenu(string labelBouton, string nomRessource, Stream imgageStream, short fromToolBarOrManuBar, ref Office.CommandBarButton bouton)
{
Assembly ThisAssembly = Assembly.GetExecutingAssembly();
bouton = null;
if (fromToolBarOrManuBar == fromToolBar)
{
bouton = (Office.CommandBarButton)newToolBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, missing, false);
bouton.Style = Office.MsoButtonStyle.msoButtonIconAndCaptionBelow;
}
else if (fromToolBarOrManuBar == fromMenuBar)
{
bouton = (Office.CommandBarButton)_objNewMenuBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, 1, true);
bouton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption;
}
bouton.Caption = labelBouton;
Random random = new Random(10000);
bouton.Tag = "Basic Tag" + random.Next(1000).ToString();
imgageStream = ThisAssembly.GetManifestResourceStream(namespaceCourant + ".Resources." + nomRessource);
bouton.Picture = MyHost.GettIPictureDispFromPicture(Image.FromStream(imgageStream));
bouton.Click += new Office._CommandBarButtonEvents_ClickEventHandler(Lancement_Formualire_Event);
bouton.Visible = true;
}
And here where I call this method :
private void AddMenubar()
{
Stream imgageStream = null;
try
{
_objMenuBar = this.Application.ActiveExplorer().CommandBars.ActiveMenuBar;
_objNewMenuBar = (Office.CommandBarPopup)_objMenuBar.Controls.Add(Office.MsoControlType.msoControlPopup, missing, missing, missing, false);
if (_objNewMenuBar != null)
{
_objNewMenuBar.Caption = "RPVApp";
_objNewMenuBar.Tag = "RPVApp tag";
creationBouton_SubMenu("Nouveau message civil", "message.png", imgageStream, fromMenuBar, ref bt_NouveauMessageCivil);
creationBouton_SubMenu("Réception messages", "message2.png", imgageStream, fromMenuBar, ref bt_ReceptionMessage);
}
}
And finally here the call to create the tool bar items :
Stream imgageStream = null;
if (newToolBar == null)
{
Office.CommandBars cmdBars = this.Application.ActiveExplorer().CommandBars;
newToolBar = cmdBars.Add("RPVApp_Toolbar", Office.MsoBarPosition.msoBarTop, false, true);
}
try
{
creationBouton_SubMenu("Nouveau message civil", "message.png", imgageStream, 1, ref bt_NouveauMessageCivil);
creationBouton_SubMenu("Réception messages", "message2.png", imgageStream, 1, ref bt_ReceptionMessage);
newToolBar.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Thank you in advance for your help !
modified 31-Jul-12 6:25am.
|
|
|
|
|
Effectively you are trying to add the same buttons twice. I know that you are adding them to different locations, but you have added it twice (which means you have ended up with 2 Click event handlers for each button). You only need to assign the Click event handler once. This should work:
if (bouton.Click == null) bouton.Click += new Office._CommandBarButtonEvents_ClickEventHandler(Lancement_Formualire_Event); I've just typed this in the CP editor, so you may need to adjust it.
|
|
|
|
|
Thanks for the quick answer !
It makes sense, but the compiler refuses the clause
if (bouton.Click == null) , saying that this kind of instrction should be placed before += or -= !!
|
|
|
|
|
I wondered about that - you should probably move this creation to just after you have instantiated the button then.
|
|
|
|
|
I tried that but no, still the same problem !
|
|
|
|
|
Never mind - I saw that you were nulling the button field, so this is not it. Try writing out what the sender was in your event handler. You should be able to do it like this:
Button button = sender as Button;
if (sender != null)
{
Debug.WriteLine(button.Tag);
}
|
|
|
|
|
Problem solved. It was the tag !! Random function was giving me the same value each time ! Thank you for your help anyway !
|
|
|
|
|
No problem. If you explicitly seed a random number to a fixed value, whenever you use the Random method on a newly instantiated random generator you get the same values. This line is the offending line:
Random random = new Random(10000); Just use Guid.NewGuid(); to create your tag.
|
|
|
|
|
Hi
I’ve extremely log file that I need to parse, 700M
I need to read the file content and parse each line,
The problem is that I get exception System.outofmemory
In order to solved the memory issue, I think of reading the file in pages
I think of defile pageSize to be 100,000 lines
In order clean memory of array such as fileLinesContent, I think of defining it as null or to call Array.Clean(fileLinesContent)
Is it correct approach to clean memory of array?
string []fileLinesContent;
internal void ReadFile(int pageSize)
{
//To clean memory for garbage collector
fileLinesContent=null;
List<string> fileLines = new List<string>();
int linesNumRead=0;
string line;
while (linesNumRead < pageSize && !srLog.EndOfStream )
{
line = srLog.ReadLine();
linesNumRead ++;
}
fileLinesContent = fileLines.ToArray();
}
}
|
|
|
|
|
Ronenb wrote: Is it correct approach to clean memory of array?
Once the array is out of scope, the garbage-cleaner will reclaim that memory. Might not do it immediate, but when it thinks that it's required.
What are you going to do with the array of lines? Maybe there's a better solution, like passing a stream.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
hi
the array (string []fileLinesContent) is a member of the class, not local member in func,
so my question is how to clean it in order free memory and read next lines in files
i'm reading the lines because i need to know when the line end and parse the element in each line
ronen
|
|
|
|
|
Ronenb wrote: the array (string []fileLinesContent) is a member of the class, not local member in func,
Then it's memory will be released once the object goes out of scope.
Ronenb wrote: so my question is how to clean it in order free memory and read next lines in files
You can't dispose memory manually; there's a garbage-collector to do so. Very long strings are moved to the Large Object Heap, and simply stay there.
Ronenb wrote: i'm reading the lines because i need to know when the line end and parse the element in each line
I'd recommend reading from a Stream , until you encounter that newline-character, and process it immediately. There's little need to keep all that information in memory.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|