|
you have
if (!Page.IsPostBack)
{
Response.Buffer = true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";
if (Session["UserName"] != null)
{
try
{
lblMsg.Text = Session["Type"].ToString()+" ("+ Session["UserName"].ToString()+")";
}
catch
{
Server.Transfer("../Admin/Default.aspx");
}
}
else
{
Server.Transfer("../Admin/Default.aspx");
}
}
correct? what you might try is
Response.Buffer = true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";
if (Session["UserName"] != null && Session["Type"] != null)
{
lblMsg.Text = Session["Type"].ToString()+" ("+ Session["UserName"].ToString()+")";
}
else
{
Response.Redirect("../Admin/Default.aspx");
}
you only need to have type in the if statement if there is a chance it could be null whitout the UserName bieng null. notice that there is no if(!Page.IsPostBack) statement, this way the code will run EVERY postback, if the session times out and the user tries something they will be redirected to the login(i assume default.aspx is your login page, if its in the same directory as the current page you dont need the relative path just Default.aspx) the nocache options are always set so the back button is effectivly broken(provided they work correctly). this should work, but if the nocache part doesnt, try using meta tags instead.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Same probs But if i put the code given below is working fine in Internet Explorer but not in Flock and Netscape
<%@ OutputCache Location="none" %>
Now please suggest wht's the problem
|
|
|
|
|
i dotn respond well to orders, when i'm trying to help someone regarless of how politely they're given. i've suggested that if changing values in the response object doesnt work to try meta tags, its what i use and they work perfectly, any decent developer would have tried the suggestion or at least mentioned trying it and having problems if it didnt work, i , for the last time, recomend you do a google search about disabling page cashing and try out what you find which should include several options that work in several browsers.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Try this in page header:
<meta http-equiv="pragma" content="nocache" />
|
|
|
|
|
where is to put this line of code u've given
Actually i'm using Master Page and Content Page so should i keep this line of code in Master Page if yes i've done it but same output getting working in Internet Explorer but not in Flock and Netscape Navigator
|
|
|
|
|
Hello,
I am trying to upload files using CopyTo function of FileInfo.
The code I am using is as follows...
FileInfo fileObj = new FileInfo(filUpload1.PostedFile.FileName);
string fileType = filUpload1.PostedFile.ContentType;
string newFileName = "test.txt";
string folderPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Uploads");
fileObj.CopyTo(folderPath + "\\" + newFileName);
The exception I am getting is...
Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\help.txt'.
Help.txt is the name of the file I selected using FileUpload control.
I could have used the SaveAs function of FileUpload control but I want to try it using above method. The files gets successfully uploaded when I do it on my machine but after uploading it on web server, it throws the above exception.
Please suggest.
Thank You.
|
|
|
|
|
Well Mr. Lucknow,
The reason behind this exception is that it is trying to find the file to be copied (in your case, it is help.txt) on the web server where it is not present.
In short, you can use this way to upload file to the web server.
|
|
|
|
|
<asp:linkbutton runat="server" id="btn_link" text="<%#Eval("p_link")%>" commandname="link" onclientclick="window.open('<%#Eval('p_link')%>');" xmlns:asp="#unknown"></asp:linkbutton>
please some one tell me why this is not work properly. can i do it or not. if not than how can i open this link in new window beacause its fill in ifrmae so open only in particular portion of the site.
thanks
I will do my best?
modified on Wednesday, August 13, 2008 8:38 AM
|
|
|
|
|
Please don't post HTML tags in your subject. It was being swallowed and thus no-one could look at your quesiton. Sorry, I didn't check to come up with a decent header.
What does 'not working properly' mean ? What is the HTML that is generated ? Is the #Eval not parsed properly ?
I am certain that as it's C# code, you can't use single quotes for the string you pass to Eval.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
thanks to reply.
yes this is c# code if i use in Eval single quote or in double quotes error is :
Error: missing ; before statement
Source File: http://localhost:1220/Adv/cate1.aspx
Line: 1, Column: 23
Source Code:
"window.open('<%#Eval("p_link")%;
how can i solve this problem
I will do my best?
|
|
|
|
|
hai,
currently i m using asp.net with c# (2.0 framework) and sql server 2000.
i finished my project and going to give the final link to my naive user (i have an intranet server with me). my link is like http://10.10.10.10:2001
Now my user need it as like his project, so that if the user enter his project name (say... MyProject) in the address bar of IE, then his project is to be open. (as like the internet link).
is there anyway to achieve it?
Thanks in advance.
KARAN
modified on Wednesday, August 13, 2008 8:07 AM
|
|
|
|
|
Buy a server space n upload ur project their.
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
I have an intranet server mwith me Mr.Anand Desai. i dont know how to implement it ? can u tel me?
|
|
|
|
|
This has nothing to do with programming.
What you need to is creating a mapping on Intranet DNS for this IP address to whatever name you like(let’s say My Project)
|
|
|
|
|
thanks a lot bhardway.. can u guide me how to map on intranet DNS for my ip address?.... plz....
|
|
|
|
|
I'm sure there are articles out there which will help you.
As has been said this is not a programming question, you are in the wrong forum. You may get more help posting in another forum.
|
|
|
|
|
in my project i need tomake a grid thrugh i can enter record to store
so i need to add new row at run time in grid view
so how too do it
Raghvendra
|
|
|
|
|
This is one way. This example adds an empty row in the gridview
Private Sub GridView1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.PreRender
Dim GV As GridView = CType(sender, GridView)
Dim Tbl As Table = CType(GV.Controls(0), Table)
Tbl.Controls.AddAt(index, AddEmptyRow)
End Sub
Function AddEmptyRow() As GridViewRow
Dim GVR As GridViewRow = New GridViewRow(0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Normal)
Dim cell As TableCell = New TableCell
cell.ColumnSpan = ColumnCount
cell.Text = " "
GVR.Cells.Add(cell)
Return GVR
End Function
|
|
|
|
|
Thanks for this code
but when i pasted this code at my page it gives error
Tbl.Controls.AddAt(0, AddEmptyRow)
Line gives error:
Specified argument was out of the range of valid values. Parameter name: index
Raghvendra
|
|
|
|
|
Exchange index for the rownumber you want to insert the new row at
|
|
|
|
|
I made a mistake in my code when i removed it it work properly
Thanks a lot
Raghvendra
|
|
|
|
|
Sir this code only help you in adding one row but when u want to add more row how to deal with
I mean
i added a row in which text box was there thrugh u can enter data but after filling it i want to add more rows to it
but i m not able to do it
Raghvendra
|
|
|
|
|
Where is your data coming from that prevents you from adding it the normal way via a dataset for example?
|
|
|
|
|
Sir in this data is not coming from anywhere but i m filling data thrugh this grig rows
Raghvendra
|
|
|
|
|
I'm not understanding what you're trying to achieve.
|
|
|
|