|
Hi ,
I am submitting a html form in ASP.NET 1.1, to a websphere server. I am browsing excel file and submitting through object to Websphere server, by sybmitting form with action as Websphere hosted address.
Whenever I login to app, and try to upload the file with above functionality, for the first time, I get redirected to Login.aspx automatically. But when I re-login again and does the same thing as above, the file is uploaded successfully.
Can you please help me regarding this, as I have maintained releative values of timeout for session and form-authentication in web.config file.
- Ajay K
modified on Tuesday, October 19, 2010 3:43 AM
|
|
|
|
|
Please try the ASP.NET forum - this is C#
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
hi, I heard that there is a method of using class to get the value from form 1 to form 2 but i not familiar with using class.So is there any advice or reference that you could provide me?
|
|
|
|
|
Hi,
you should read a book about c# and object oriented programming. Here is a solution, but I really think you should read about it so that you can understand it:
Create a form "Form2" in (e.g. in the designer) and use this code in your code behind file (e.g. Form2.cs)
public class Form2 : Form
{
private int m_nValue = 0;
public Form2()
{
}
public void SetValue(int val)
{
m_nValue = val;
}
}
then you can call the public function in your Form1:
Form2 frm = new Form2();
frm.SetValue(1);
|
|
|
|
|
I guess it would be a shared (static) class with a public property that is exposed to the outside world.
If one form has a reference to the other forn, I'd rather use a property within the other form.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Beside the other suggestions you could also just add a constructor to your 2nd form (that you call from your first form) that takes the class of your choice as an argument.
internal class Form2 : Form
{
internal Form2(MyClass obj)
{
MessageBox.Show (obj.Name + " " + obj.Number);
}
}
internal class MyClass
{
internal string Name
{ get; set; }
internal int Number
{ get; set; }
}
In Form1 you call:
MyClass myC = new MyClass();
myC.Name = "John Doe";
myC.Number = 42;
Form2 f2 = new Form2(myC);
f2.Show();
|
|
|
|
|
if i want to get the value of form2 textbox1 to form1 textbox2 what code should i create??
|
|
|
|
|
If you opened Form2 from Form1 , and want to add the value of Form2.textbox1 to form1.textbox2 I would do this using delegates .
Check out this[^]link (Second Scenario) which explains it. Good luck 
|
|
|
|
|
|
You can also try making a property as static for FORM1 and then add the reference of FORM1 in FORM2 then with the class name in which you have defined/declared the property as static; you can easily get it by Class Name.
|
|
|
|
|
Not a good idea - there are several much better ways to do this than using static. Consider the same problem when using non-Form related classes: If you use your static solution what happens when there are two instances? What happens when multiple threads are involved?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Best Solution: Learn how to program in .NET and OOP. (This is quite a basic problem, I think you didn't understand the concept of instances, scope, access modifiers etc.)
2nd Solution: Follow the advices here (but don't follow the "make a static property" advice!)
Dirty Solution: Just declare your TextBoxes as "public" (you can set the "Modifier" in the VS-Designer).
I'd head for the "best solution" - learn your basics. This will really help you! ![Rose | [Rose]](https://codeproject.freetls.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
Explain in more detail how Form 1 is related to Form 2. How are each instantiated? In what order are they displayed? Is it always the same or does this change?
|
|
|
|
|
Hi (im German so please forgive my bad english),
I wrote a c# .net 4.0 Program that gives me results from different calculations into different variables with different datatypes (myInt, myDouble, myString, myBool, myWhatevr)
Now i wanted to give al this results to my xml file that is used as a logfile.
This is my xml code:
using System;
using System.Xml;
namespace xml_exporter
{
public class xml_tool
{
public static void tel_toXML()
{
string dateTime = DateTime.Now.ToString("yyyyMMddhhmmss");
XmlTextWriter myXmlTextWriter = new XmlTextWriter("C:\\XML-Log_" + dateTime + ".xml", System.Text.Encoding.UTF8);
myXmlTextWriter.Formatting = Formatting.Indented;
myXmlTextWriter.WriteStartDocument(true);
myXmlTextWriter.WriteStartElement("Data");
myXmlTextWriter.WriteComment("Start");
myXmlTextWriter.WriteElementString("Farbe", "Blau");
myXmlTextWriter.WriteElementString("Struktur:", "Rau");
myXmlTextWriter.WriteComment("Farbnummer" "");
myXmlTextWriter.WriteElementString("Dichte", "");
myXmlTextWriter.WriteElementString("Name", "");
myXmlTextWriter.WriteElementString("Aktiv", "");
myXmlTextWriter.WriteComment("End");
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.Flush();
myXmlTextWriter.Close();
}
}
}
Now i want to know how to give my variabel values to the xml construct!?
so that the xml-file should look "like" this:
Colornumber ValueOfmyInt variable Colornumber <br />
..<br />
Dichte 5.4 Dichte
etc.
However I searched in the c# openbook, msdn I didnt found the right answer to my problem. And there must be a Code or a Command to give the values of my variable to the XML thing.
I'm just always finding "how to read from xml" and stuff but thats not the same I think. Im still trying to build something up but its not working.
Ich flehe um Hilfe!
Does anyone have an idea how i can realise this ? Or a Link for exact this problem etc.? It would be a very big help for me.
greetz,
Sal
|
|
|
|
|
You want to write the value of some variables to XML? Did you scan the list of methods XmlTextWriter offers, in particular the ones that start with Write?
|
|
|
|
|
yes but maybe i understood it wrong. i thought write writes the file to a path not a variable to xml element.
ok worked for things like
Int32 = myInt = 3;
and then inserted the line : myInt.ToString()
so from now on the value is sended to the xml element.
thanks
modified on Monday, October 18, 2010 10:26 PM
|
|
|
|
|
Luc has already given you the answer, see here[^].
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi,
I'm trying to dial phone number and using SerialPort control for this, which is initialized with my USB modem.
SerialPort serialPort1 = new SerialPort("COM5", 115200, Parity.None, 8, StopBits.One);
serialPort1.Open();
serialPort1.Write("ATDmyphone\r");
serialPort1.Write("ATH\r");
serialPort1.Close();
everything works except 1 thing - there is no sound from the modem.
I tried to use ATM2 and ATL3 commands before I start to dial - but there was still no sound. But when I create dial-up network connection, and dial from its dialer - there is a sound.
What am I missing here?
thanks!
|
|
|
|
|
Are you sure it isn't just dialing pulse? That can be harder to hear than tone. You should use ATDT just to make sure.
|
|
|
|
|
I used ATDT as well - no sound 
|
|
|
|
|
Hi,
what does modem answer to each command?
Bye
|
|
|
|
|
this is the code:
serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1_DataReceiver);
serialPort1.Open();
string answer;
serialPort1.Write("ATM2\r");
answer = serialPort1.ReadLine();
serialPort1.Write("ATL3\r");
answer = serialPort1.ReadLine();
serialPort1.Write("ATDT" + phone + "\r");
answer = serialPort1.ReadLine();
serialPort1.Write("ATH\r");
answer = serialPort1.ReadLine();
serialPort1.Close();
'answer's' value are commented.
thanks.
|
|
|
|
|
Hi,
please try ATM1\r instead of ATM2
bye
|
|
|
|
|
I tried, but there is still now voice 
|
|
|
|
|
I don't know, however I would insert a big delay (3 seconds as a first experiment) between every pair of statements, so the system can settle before your program continues; as it is now, it is all done in a few milliseconds, maybe something isn't fast enough to keep up.
If that helps, you then can reduce the delays until it starts to fail again.
|
|
|
|