|
Hi all,
If the client borwser is cookies disable then i want to show a message to client plz enable ur cookies.......
for this i am writing this code but it is not working
<script language="javascript" type="text/javascript">
function detect()
{
if(navigator.cookieEnabled)
{
alert('Your browser has cookies enabled.');
}
else
{
alert('Your browser has cookies disabled.');
}
}
</script></head>
<body onload="detect();"></body>
Thanks a lot........
|
|
|
|
|
Just store a cookie and try to retrieve it using javascript. If proper value is retrieved, you will find cookie is enabled.
|
|
|
|
|
Thnks for Replying ........
I am using IE and also block all cookies but
allways answer is ........"cookies found" by fallowing code
if (!IsPostBack)
{
Response.Cookies["test"].Value = "Samar";
Response.Cookies["test"].Expires = DateTime.Now.AddYears(30);
if (Request.Cookies["test"] == null)
Response .Write ("No cookie found");
else
Response .Write ("cookies found");
}
if I used gmail then message is comming that plz enable ur cookies ?
while according previois code it means cookis is creaing ?
then what is exat answer cookies is enable or disable ?
|
|
|
|
|
Did you try redirecting the page, and find cookies from another page ?
Say in your page1 you place :
Response.Cookies["test"] = "Samar";
In page2 you try to retrieve it using :
if(Request.Cookies["test"] == null)
Response.Write("No cookie found");
During the login process, Gmail actually redirects to more than one page before going to actual Gmail Console. So it is easier to them to understand if cookie is actually enabled or not.
I think if you do like this in your login process, you can easily detect this.
|
|
|
|
|
Yes ..........Dear I have done according to you
in first page button clic event I M writng this .....
Response.Cookies["test"].Value = "Samar";
Response.Redirect("Default2.aspx");
and second page form load event
if (Request.Cookies["test"] == null)
Response.Write("No cookie found");
else
Response.Write("cookie found");
I have disabled the cookie but it is still showing "Cookies found"
Note-- I M using IE.
|
|
|
|
|
I think this means cookie is not disabled properly in your browser. If the cookie could be read, then browser didnt prevent it to store cookie properly.
Also try in other browser and try publishing the application in IIS.
|
|
|
|
|
Yes it is Working in Mozilla but not in IE6
How can we check it IE6.........Thnks.......
|
|
|
|
|
try this one
Request.Browser.Cookies
|
|
|
|
|
I thing it is for ur borwser supports cookies or not but not for cookies enable or disable
|
|
|
|
|
I dont know.. But if you can still access the data with Cookies disabled, I think this would be the problem of security in the browser itself which allows the server to read cookies, even if it is disabled.
I think it is always better not to rely on data in Cookies. I wonder how the client browser behaves and even clients can delete cookies any time.
|
|
|
|
|
my Page contain a gridview with a sqldatasource that have a parameter programatically set value
after sqldatasource run a select statement to bind data
i need to have a selectedindex of row for select button
but it gets me error of index out of range
I have done checking..
it seems to me that this gridview get the selectedindex value after twice postback
let say i click on index 1
another click on index 2
the result is selectedindex = 1
that's the problem
|
|
|
|
|
Index for Datagrid starts from 0.
Put your code here so you can get more help.
Rock Star
|
|
|
|
|
The table has columns batch_id, task_id, seq.
One batch_id has several task_id and one task_id can have several seq.
task_id can be A, B, C or others.
I need to write a sql command that can get a table:
count(task_id when task_id = value1), count (task_id when task_id = value2),...
Can anyone help me that how to change the column value to be a column?
|
|
|
|
|
This is not relating to ASP.Net. Post the query in proper forum.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
|
Thanks for you answer and your reminding.
|
|
|
|
|
Hi,
In my application i have a form where in which when i submit the form by clicking on the submit button it will do some operation .This operation has to be performed only once so i have disabled that button once it gets clicked to avoid the multiple clicks of it by writing the code
Button1.Enabled = false;
in the button click event , this is working fine but when i am redirecting to another page after completion of the operation in that button click code , the button is not getting disabled .Because of this, even though i have disabled the button when a user clicks on the button multiple times that particular operation is getting executed the number of times the button is clicked instead only once .
here is my button click code
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Enabled = false;
Response.Redirect("http://abc.com/test.apsx");
}
Please can anyone help me to resolve this problem
Thanks in advance
|
|
|
|
|
are you redirecting user to same page?
Cheers!!
Brij
|
|
|
|
|
Hi,
thanks for the reply , no i am not redirecting to the same page .I need to to redirect it other page.
Thanks
|
|
|
|
|
Your Qs is not clear.When you redirect to another page then how the button which was on earlier page is visible.
Anyways you can have a flag in session set it when user click on the button once and put your enable/disable button code on the pageload.
Cheers!!
Brij
|
|
|
|
|
Hi,
When the current page is redirecting to another page it is taking some time , in that time only user can click on the button multiple times .As you said if I use session there may be a chance of user clearing the browser sessions , if it does not happen also for the first button click i will do some operation and the result of that operation has to be sent to another page but if I use the session for the first click of the button some operation is done and trying to redirect to another page and meanwhile if user again clicks on the button i will check for the session and will not perform the same operation again but redirection will not happen in this case . Please suggest me the solution.
Thanks
|
|
|
|
|
Ok try to disable it from javascript.It should work
Cheers!!
Brij
|
|
|
|
|
Hi Brij,
Thanks for your support, I have tried it using java script and its worked for me.
I have taken a hidden field , for the first click of the button i will assign some value to that hidden field .For every hit of the button one java script function will be called and there i will check for the hidden field value , if there is any value in it i will not do anything.
|
|
|
|
|
Hi all
How to perform redirection from global.aspx.
Amit Patel
|
|
|
|
|
Amit Patel1985 wrote: How to perform redirection from global.aspx.
I guess you are talking about global.asax not aspx .
Just try with this :
Context.Response.Redirect()
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|