|
Still Not working
<img src="<%= Page.ResolveUrl('~/Imgaes/Back1.jpg') %>"> </img>
giving a compilation error as given below
Compiler Error Message: CS1012: Too many characters in character literal
|
|
|
|
|
In ASP.NET, we have a download handler. We use this to send files to the users that they should be prompted to either Open or Save, rather than show inline in the browser. Through a combination of a couple sets of code, we ended up doing the equivalent of:
/* anti-cache code */
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.MinValue);
/* download prompt code */
Response.AppendHeader("Content-Disposition", "attachment; filename=" + ff.OriginalName);
This tells the browser not to cache the results (first set of code), and to give the Open/Save prompt (second set of code). Unfortunately, because of the way IE is architected, it always downloads to its cache, and then when the download is complete, puts the end result file in the right place. Logically speaking, IE put itself into a place architecturally when it would NOT permit the file to be downloaded.
how can I handle it in asp.net
I want to do these two things..cache clearing for disabling back button and downloading
|
|
|
|
|
I know this may not be the correct forum but its a simple question and I tend to get a quikcer response here!
what is the short cut to start sql seerver if i go to START - RUN
thanks in advance 
|
|
|
|
|
|
This doesn,t work with me 
|
|
|
|
|
Hi All ASP.NET Gurus
I am trying to find a way to use Session Variables for caching multiple copies of a user control in a web page.
I know we can use QueryString values as well as Control ID's in the VaryByParams option in the user contol file.
But what about session variables? That way I do not have to fill me querystring with too much info?
Any Ideas?
Thanks in advance!
Josh Coswell
http://riverasp.net
|
|
|
|
|
I would personally loop al the controls and then store as session variables, that is my preferred choice, obviosuly the session variables can expire though
|
|
|
|
|
Hi every one!
I'm making a composite web custom control which includes an ImageButton so I want to access it's Click event in design mode in property. I have some code like below in my program and it works! but when in a web page I use the event method both of my control event method in web pge and my control event method in the control library class run, but I want some thing like overriding it!
thanks for any help
here is the code:
//in my constructor:
_imageButton.Click += new ImageClickEventHandler(_imageButton_Click)
//and then:
public virtual void _imageButton_Click(object sender, ImageClickEventArgs e)
{
if (Convert.ToInt32(_rowID)!= -1)
{
_textContainer.Text = _tableAdapter.GetData()[Convert.ToInt32(_rowID)].FDtext;
}
}
//so I defined my event like this:
[Browsable(true)]
public event ImageClickEventHandler TitleClicked2
{
add
{
_imageButton.Click += value;
}
remove
{
_imageButton.Click -= value;
}
}
|
|
|
|
|
this seems like a vary clunky way to code what your trying to do, any1 else agree?
surely you just have the onclick event and then the button and thats it
|
|
|
|
|
Hi,
I wrote a code for sending mail but when runninin the page this error appears :
No connection could be made because the target machine actively refused it (an IP):25
Why ?
Best wishes
|
|
|
|
|
A number of things could be the problem including the following:
The port is blocked
Or you are using the wrong port
Can you post your code as well please
|
|
|
|
|
I guess your mail server settings are wrong.
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 )
|
|
|
|
|
Recently I have fixed the problem by configuring the IIS setting on your m/c.
In Default SMTP server of your (IIS) Choose Access Tab and Configure Rely with IP 127.0.0.1.
Then restart the smtp service.
Hope it will helps you 
|
|
|
|
|
HI All
can anybody tell me how to find substring count occurs in a string in asp.net C#.
for example..
string str = "Ram was not there. Ram has been gone to market";
if I wand to find count of "Ram" in this string , then it should return 2
please help me..
thanks
|
|
|
|
|
//Function to count no.of occurences of Substring in Main string
public static int CharCount(String strSource,String strToCount)
{
int iCount=0;
int iPos=strSource.IndexOf(strToCount);
while(iPos!=-1)
{
iCount++;
strSource=strSource.Substring(iPos+1);
iPos=strSource.IndexOf(strToCount);
}
return iCount;
}
|
|
|
|
|
|
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
|
|
|
|