|
This is a C# question. The easiest way probably is to call the split method and see how many elements it returns.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello friends
I have generated the web.sitemap file from the databse in my c drive.
Now I am facing problem while binding this to ths menu control please help....
Deepak Nigam
|
|
|
|
|
Please can you explain exactly what your problem is
|
|
|
|
|
Hi all...
I have a login form (username and password), and I want to add a checkbox (remember me), how can I perform this cookie?
Thanks alot
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
This article shows you how to implement the above functionality in ASP.NET.
Step 1: Add a checkbox in the login page
You can add a checkbox in the login page by dragging and dropping a checkbox from the toolbox when you are in page design mode, or you can create a checkbox programmatically in the code behind class.
The following code shows you how to do this in the second way:
private CheckBox _rememberMeCheckBox;
//.....
this._rememberMeCheckBox = new CheckBox();
this._rememberMeCheckBox.Text = "Remember me next time");
this._rememberMeCheckBox.Checked = true;
this.Controls.Add(this._rememberMeCheckBox);
//.....
Setp 2: Creat a cookie when a subscriber login
create a cookie in the Cliked event handler of the login button:
private void _LoginButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
//....
//....
ApplicationUser user = ApplicationUser.RetrieveCurrentUserByLoginId(userId);
if (user != null && user.Password == password)
{
Session["user"] = user;
Response.Cookies.Remove("CookieFromXXX");
if (this._rememberMeCheckBox != null &&
this._rememberMeCheckBox.Checked)
{
HttpCookie cookie = new HttpCookie(string.Format("cookie_from_{0}", this._host));
cookie.Values.Add("userId", user.Id);
cookie.Values.Add("pwd", user.Password);
cookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(cookie);
}
}
//....
//....
}
Step 3: Override the OnInit method in the base page
If there is a base page which is the parent page of all other pages in your website, you can override the the OnInit method in the base page like the following code:
override protected void OnInit(EventArgs e)
{
//....
//....
if (!IsPostBack && Session["user"] == null)
{
if (Request.Cookies["CookieFromXXX"] != null)
{
HttpCookie cookie = Request.Cookies["CookieFromXXX"];
string userId = cookie.Values["userId"].ToString();
string pwd = cookie.Values["pwd"].ToString();
ApplicationUser user = ApplicationUser.RetrieveCurrentUserByLoginId(userId);
if (user != null user.Password == pwd)
{
Session["user"] = user;
}
}
}
base.OnInit(e);
}
Or you can add the above logic in the OnLoad method in the home page.
Step 4: Use the Session["user"] to determine the subscriber logged in or not
In any web page, you can check the Session["user"] to determine the subscriber logged in or not, see the following code:
if (Session["user"] != null)
{
//logged in already
//....
}
else
{
//haven't logged in yet
//....
}
Step 5: Expire the cookie when subscriber logout the website
Add the following code to expire the cookie when subscribers logout the website.
this.Session.Clear();
if (Response.Cookies["CookieFromXXX{0}"] != null)
{
//Response.Cookies.Remove("CookieFromXXX");
Response.Cookies["CookieFromXXX"].Expires = DateTime.Now.AddDays(-1);
}
Response.Redirect("./homepage.aspx");
|
|
|
|
|
could you please write it using VB.NET
Thanks alot
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
why don't you try converting it yourself, there are plenty of converters out there and the rest you cvould probably do yourself
|
|
|
|
|
I did it
thanks alot
regards
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
i have stored excel file in database i have to display it in a panel control. now my excel file is opening in a seperate window. i have written this code in page load event
my code is
try
{
string val = Session["f"].ToString();
connect = ConfigurationManager.AppSettings["connection"].ToString();
SqlConnection Sqlcon = new SqlConnection(connect);
string ssql = "select contents from reports where modulename='"+val+"'";
Sqlcon.Open();
DataTable dt = new DataTable();
SqlDataAdapter Sqladp = new SqlDataAdapter(ssql, Sqlcon);
Sqladp.Fill(dt);
int count = dt.Rows.Count;
for (int i = 0; i < count; i++)
{
byte[] file = (byte[])dt.Rows[i]["contents"];
// Response.ContentType = "application/ms-excel";
Response.ContentType = "application/xls";
//Response.BinaryWrite(file);
Response.OutputStream.Write(file, 0, file.Length);
//Response.End();
}
Sqlcon.Close();
}
catch (Exception EX)
{
string ERR = EX.Message;
}
finally
{
//Sqlcon.Close();
}
plz help to display in panel control
|
|
|
|
|
Don't double post. It's rude. People will ignore both your original message and this one.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi friends,
i am using ftpwebrequest to upload files on ftp server here is my code.
string uri = "ftp://myuserid:mypwd@ftp.shopzilla.com/myfile.txt";
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.Proxy = null;
reqFTP.Credentials = new NetworkCredential("myuserid", "mypwd");
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = fileInf.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
try
{
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
strm.Close();
fs.Close();
}
catch (WebException webEx)
{
WriteLog("Adding to Bizrate webex : " + webEx.Response.ToString());
WriteLog("Adding to Bizrate webex : " + webEx.Status.ToString());
WriteLog("Adding to Bizrate webex : " + webEx.Message);
}
catch (Exception ex)
{
WriteLog("Adding to Bizrate : " + ex.Message);
}
i am getting error
The remote name could not be resolved: 'ftp.shopzilla.com'
and status NameResolutionFailure
please give me any solution or link to solve this
Thanking you,
Laxmikant Lad
|
|
|
|
|
Hi
I have two database table there structure as follows..
ADA_category
catid catname status amount
and second table contain
ADA_Question
qid catid question status
I am adding question in each category and displaying category to the user in datagrid. But i want to display only those category which having more that or equal to 25 question.
How can i do this in a single query.
Please guide me.
Thanks I solved the problem
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
modified on Tuesday, March 18, 2008 2:21 AM
|
|
|
|
|
i have stored excel file in database i have display it in panel control.
my code is
try
{
string val = Session["f"].ToString();
connect = ConfigurationManager.AppSettings["connection"].ToString();
SqlConnection Sqlcon = new SqlConnection(connect);
string ssql = "select contents from reports where modulename='"+val+"'";
Sqlcon.Open();
DataTable dt = new DataTable();
SqlDataAdapter Sqladp = new SqlDataAdapter(ssql, Sqlcon);
Sqladp.Fill(dt);
int count = dt.Rows.Count;
for (int i = 0; i < count; i++)
{
byte[] file = (byte[])dt.Rows[i]["contents"];
// Response.ContentType = "application/ms-excel";
Response.ContentType = "application/xls";
//Response.BinaryWrite(file);
Response.OutputStream.Write(file, 0, file.Length);
//Response.End();
}
Sqlcon.Close();
}
catch (Exception EX)
{
string ERR = EX.Message;
}
finally
{
//Sqlcon.Close();
}
|
|
|
|
|
Have you solved this? How about using Office Interop?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hello friends,
I have created my first application in .Net 2005 but i am not able to find the .dll file.
Can anybody tell me where the .dll file of the application get saved?
Thanks,
Nagendra.
|
|
|
|
|
It doesn't, by default in VS2005 your pages are compiled the first time someone requests them.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
Right click on project name then select publish website and select the path where you want to create dll file.
Regards
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
Hi All
I have the following element
<span id="Label2" style="display:inline-block;border-width:1px;border-style:Solid;width:200px;">Label</span>
(Actually this is the output of the ASP.NET Label Server Control)
I get two different outputs when I use IE and when I use FireFox browsers.
Has Anybody seen this.?
Thanks
Josh Coswell
http://riverasp.net
|
|
|
|
|
Odd that an ASP.NET control would not adapt, but different styles from the same css between browsers is common.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
First of all ,thanks for your kind reply...
I ahve a doubt.Is it possible to check the extension and file size of an image uploaded using asp file upload control using custom vallidator.I check the file size using client vallidation .It is work properly,but i want to include extension checking in the same custom vallidator.i will attach the size code below .plz answer for this question.
function LengthVallidation(source,value)
{
if((document.all('Upload_Logo').value.length>1080000))
{
value.IsVallid=false;
return false;
}
else
{
value.IsVallid=true;
return true;
}
}
Means allow only .jpg extension images...
|
|
|
|
|
|
SreejithAchutan wrote: First of all ,thanks for your kind reply...
You already thanked everybody for their reply...
“The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”
|
|
|
|
|
hello frnds
i am using asp.Net 2.0 n develope a web-site in it, can i give windows Vista effect to my web application ???
what should i do to give better look to my web-site???
thankx in advnace
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
You can skin it any way you like.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thankx for Reply...
any example to use scin in asp.Net 2.0, that gives look like vista ???
thankx in advance
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|