|
Is you're Main function marked as STAThread? Sometimes this can cause bizarre behaviour. I came across something almost identical to this (if I remember correctly) and it was solved by adding a STAThread attribute to Main.
Ed
|
|
|
|
|
Hi all!!
I a bit confused on the expiration of a ticket, and a cookie.
I have the following code:
FormsAuthenticationTicket objTicket = new FormsAuthenticationTicket(
1, // version
Context.User.Identity.Name, // username
DateTime.Now, // issue date
DateTime.Now.AddHours(1), // expires every 1 hour
false, // don't persist cookie
strMemberRoles // member roles
);
And...
Response.Cookies["myCookie"].Expires = DateTime.Now.AddMinutes(5);
What happens if the user uses the site for exactly 1 hour and 1 minute. This means that the ticket and cookie has not expired? Does the cookie only expire 5 minutes of being on a page that hasn't been used for 5 minutes?
If the ticket only expires after an hour, what is the use of assigning it so long if the cookie expires after 5 minutes?
Please can someone help me!!
Regards,
ma se
|
|
|
|
|
why we can only access xml file which is created under folder
project/bin/debug only.is there any way by which we can access file which is created in some other folder.
rahul
|
|
|
|
|
You should be able to access xml file or any other file type on any folder, provided you have access to the folder and files. Did you put in the full path (ie c:\mydata\xmlfilename.xml)?
|
|
|
|
|
In Visual Studio 2003, like I can avoid that the user does not change the size of the columns of a datagrid and listview?
Thank you and sorry for my english
|
|
|
|
|
Hi all!!
I have the following global variable in my globals.cs file:
public static readonly string REGEXP_ALPHANUMERIC_WITH_SYMBOLS = "[\\u00E8-\\u00EB\\00FCa-zA-Z\\d\\-',&.@#/ ]";
I use this for my regular expression. I want to add a \ to the string. I tried using \\, but when I use my regular expression it does not work. After creating my regular expression it looks like:
^[\\u00E8-\\u00EB\\00FCa-zA-Z\\d\\-',&.@#/\\ ]$
Please can someone help!!
Regards,
ma se
|
|
|
|
|
|
Thanks
Are you from Cape Town?? I'm from Paarl.
|
|
|
|
|
Bellville currently to be more precise
|
|
|
|
|
Below is my C# class code
------------------
using System;
using System.Data.SqlClient;
using System.Configuration;
public class MyClass
{
static string sConnectionString ;
static MyClass()
{
sConnectionString = ConfigurationSettings.AppSettings["sConnectionString"];
}
static int ExecuteNonQuery(String sSql)
{
SqlConnection cnn = new SqlConnection(sConnectionString);
SqlCommand cmd = new SqlCommand(sSql,cnn);
cnn.Open();
int retVal = cmd.ExecuteNonQuery();
cnn.Close();
return (retVal);
}
}
-------------------
whenever i call ExecuteNonQuery method of above class(without instancing this class) i want the value of sConnectionString which is defined in Constructer. Please give me a solution.
Suhas
|
|
|
|
|
i would rewrite it as following:
<br />
public static class MyClass<br />
{<br />
<br />
public static string ConnectionString {<br />
get {return ConfigurationSettings.AppSettings["sConnectionString"];}<br />
<br />
}<br />
<br />
public static int ExecuteNonQuery(String sSql)<br />
{<br />
SqlConnection cnn = new SqlConnection(ConnectionString ); <br />
SqlCommand cmd = new SqlCommand(sSql,cnn); <br />
cnn.Open();<br />
int retVal = cmd.ExecuteNonQuery();<br />
cnn.Close();<br />
return (retVal);<br />
}<br />
<br />
}<br />
Now from any calling class you can do the following:
<br />
int result = MyClass.ExecuteNonQuery("SELECT x FROM y WHERE B = C");<br />
string conStr = MyClass.ConnectionString;<br />
if you want the ExecuteNonQuery to return both the result and the connectionstring in once, create some new class that with two properties, Result and ConnectionString, and return that class from the ExecuteNonQuery method.
|
|
|
|
|
I have a listBox with DataSource:
DataTable dt;
...
listBox1.DataSource = dt;
listBox1.DisplayMember = "value";
listBox1.ValueMember = "id";
How it is possible to get all selected values?
Because when I try:
listBox1.selectedItems[0].toString(); it returns DataRowView...
I can only get selectedIndeces but how can I retreive a value if I know index?
|
|
|
|
|
listbox1.SelectedItems[0] returns a ListItem in ASP.NET in which you can get it's value by listbox.SelectedItems[0].Value. And in Win App it returns an ObjectCollections, which could indead be a DataRowView.
So how to get the info from a DataRowView?
try the following
<br />
((DataRowView)listbox1.SelectedItems[0])[0].ToString();
The second index is the cell in your datarowview, so with the following code, you get the first cell of the first selected datarowview of your listbox and convert it to a string.
If that cell contains another object, you will have to cast it again.
|
|
|
|
|
Thank you very much.
I've tried to do it by deselecting items (SetSelected method) and using SelectedValue property...but your way is much more better. Thanks.
|
|
|
|
|
|
I know system.web.mail name space but it does not work every time.
I need more reliable library to do that. If some body knows such dll or windows application, please introduce me.
Thanks
Rastegar
|
|
|
|
|
m.rastgar wrote: I know system.web.mail name space but it does not work every time.
I need more reliable library to do that.
Could I suggest that it isn't the classes in the namespace that are unreliable but something else, for example your network connection or email server, etc.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
|
my problem is how can i tracks a server's response times and records the results of all monitoring requests into its built-in database. using Historic monitoring data and can analyzed for uptime/down time reports and trend analysis.
|
|
|
|
|
First of all there are companies that check ur site for up and down time, for example http://www.siteuptime.com/[^]
You can also write your own app, that connects every X seconds to your website, and tries to open some page. Add some timers to the app, and store the info in some database. The only problem you have is that maybe you desktop app that checks ur website is behind a not so reliable internet connection, or a slow internet connection. This might blur the results.
|
|
|
|
|
hi to all,
i have to move a word document from one directory to another, but if the document is open i can't move it.
how can i close the document before i move it (i have no instance of word to this document so i can't use the method close(), all i have is the path and the document name)
best regards and thanks in advance
fady
|
|
|
|
|
Well you can first try to move it, if it doesn't move, you can throw some messagebox response asking the user to close the Word file. You can also automatically close the word file, by using the Process class.
Something like
<br />
Process[] p = System.Diagnostics.GetProcessesByName("winword.exe");<br />
for (int i = 0; i < p.length ;i++) {<br />
p[i].Close();
}<br />
|
|
|
|
|
hii.
can we use private static field??
if yes then what is the use odf such field??
|
|
|
|
|
yes you can use it.
The use is e.g. in a singleton class with a getter of the instance
Regards
Hansjörg
|
|
|
|
|
I need to apply acertain style sheet and put table in the body of an email sent using C#.net
this is part of my code
mailMsg .Body += " name: " +
"";
mailMsg .Body +="" + name.Text + "
";
mailMsg .Body +="To: " +
"";
i want something instead of these s
Pride and No
|
|
|
|