|
I use localStorage to save a item called "key1", and then I want to read the value and display it on Label('LabelLS'). But the Label'text does not change. I am sure localStorage get the key1 item(I had used document.write(d) to print key1 item). Does somebody know how to solve it?
Protected Sub ButtonSubmit_Click(sender As Object, e As EventArgs) Handles ButtonSubmit.Click
Dim str2 As String = "<script> var d = localStorage.getItem('key1'); var c = document.getElementById('LabelLS'); c.innerHTML = d; </script>"
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "showmessage2", str2, False)
|
|
|
|
|
sir,currently we are developing mobile website in C#.we are beginners.could you pls,explain how to insert radio button control in our mobile site..am unable to see any toolbox control regarding that.
|
|
|
|
|
Actually i have a doubt.
I was thinking to make some tool but the problem is that it needs to extract some data which is in datagrid in some other site.
Is it possible to extract those data from that site and store it in,say,textbox in my site.
-ANUBHAW-
|
|
|
|
|
Yes, that is possible.
All web pages are actually an html pages. And your grid data will be in the html Table. so you need to read the html table data.
Here[^] is the sample code to read site as an html.
best of luck
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Thanks for that. Really Appreciate that but am getting a problem.
Error says:
"Could not find file 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\www.google.com'."
Am not getting that what's the problem.
|
|
|
|
|
are you using same code given in the link ?
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Hey thanks. Actually i got it. What i was missing was that i wasnt prefixing "http://" before. but it's ok now. but there's a diff issue now.
I have a page say "http://ev~.in/.../..../~.jsp"
It's showing error that
"
A potentially dangerous Request.Form value was detected from the client (txtdest="<!doctype html><html...").
Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. To allow pages to override application request validation settings, set the requestValidationMode attribute in the httpRuntime configuration section to requestValidationMode="2.0". Example: <httpRuntime requestValidationMode="2.0" />. After setting this value, you can then disable request validation by setting validateRequest="false" in the Page directive or in the <pages> configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. For more information, see http://go.microsoft.com/fwlink/?LinkId=153133.
"
I guess we cant bypass that. right?
What my main aim is that i have table under tht page (i have to login too) which shows attendance. I just want to extract the attendance thing. Is it possible?
|
|
|
|
|
|
Really sorry for bugging you. But the "unvalidated" is showing error.
it says it doesnt contain a definition for unvalidated.
|
|
|
|
|
<configuration>
<system.web>
<httpRuntime requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
</configuration>
Use above section in config file.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Thanks.
It still showing tht problem. tried tweaking things up but aint working.
Will try more.
|
|
|
|
|
there are lots of discussion on similar error. you can try one of the solution and let me know, in case you have any issue.
best luck
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
I got that.
One more question.
Suppose i want to get the html of facebook.com. it'll give me that. but once i login,it will still give the old i.e the default html code. how to get the new changed code?
|
|
|
|
|
never tried with facebook or such a big sites but for security reason they may have restricted such request. but try with storing session information and crawl all the links on the page.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Thanks a lot.
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["action"] != null)
{
if (Session["chatHistory"] == null)
{
Session["chatHistory"] = new Hashtable(); ;
}
if (Session["openChatBoxes"] == null)
{
Session["openChatBoxes"] = new Hashtable();
}
if (Session["tsChatBoxes"] == null)
{
Session["tsChatBoxes"] = new Hashtable();
}
switch (Request.QueryString["action"].ToString())
{
case "chatheartbeat":
{
chatHeartbeat();
break;
}
case "sendchat":
{
sendChat();
break;
}
case "closechat":
{
closeChat();
break;
}
case "startchatsession":
{
startChatSession();
break;
}
}
}
Hashtable s = new Hashtable();
}
private void sendChat()
{
string from = Request.Form["from"];
Session["username"] = from; // Assign Session user name value to $from value
string to = Request.Form["to"]; // Assign POST FORM 'To' value to $to value}
string message = Request.Form["message"]; // Assign POST FORM 'message' value to $message value
if (Session["openChatBoxes"] != null)
((Hashtable)(Session["openChatBoxes"]))[to] = DateTime.Now.ToString("Y-m-d H:i:s");
string messagesan = sanitize(message);
if (Session["chatHistory"] != null)
{
if (((Hashtable)(Session["chatHistory"])).Contains(Request.Form["to"]))
{
((Hashtable)(Session["chatHistory"]))[to] = "";
//((Hashtable)(Session["chatHistory"]))[getIndexOf(((Hashtable)(Session["chatHistory"])), Request["to"])] = "";
}
}
if (Session["chatHistory"] != null)
((Hashtable)(Session["chatHistory"]))[to] += "\"s\":\"1\",\"f\":\"{" + to + "}\",\"m\":\"{" + messagesan + "}\"";
if (Session["tsChatBoxes"] != null)
((Hashtable)(Session["tsChatBoxes"]))[to] = null;
/* Add Insert Query here*/
SqlDataProvider sqd4 = new SqlDataProvider();
string ConnectionString4 = sqd4.ConnectionString;
SqlConnection cnn4 = new SqlConnection(ConnectionString4);
cnn4.Open();
string query4 = "insert into dnn_DNAiusMessage_1 (UserFrom,UserTo,MessageContent,SendTime,Received) Values('" + from + "','" + to + "','" + message
+ "','" + DateTime.Now + "','" + 0 + "')";
SqlCommand cmd4 = new SqlCommand(query4, cnn4);
SqlDataReader reader = cmd4.ExecuteReader();
Response.Write("1");
Response.End();
}
private string sanitize(string text)
{
//text = htmlspecialchars(text, ENT_QUOTES); // Convert the html special characters
text = text.Replace("\n\r", "\n");
text = text.Replace("\r\n", "\n");
text = text.Replace("\n", " ");
return text;
}
private void startChatSession()
{
string from = Request.Form["from"];
Session["username"] = from;
string items = "";
if (Session["openChatBoxes"] != null)
{ // Check the Session variable
System.Collections.Hashtable openChatBoxesArray = (Hashtable)(Session["openChatBoxes"]);
for (int i = 0; i < openChatBoxesArray.Count; i++)
{ // Loop the session array
items += chatBoxSession(i); // Append to Items variable
}
}
if (items != string.Empty)
{
items = items.Substring(0, items.Length - 1);
}
HttpContext.Current.Response.Write("{ ");
HttpContext.Current.Response.Write("\"username\": \"" + HttpContext.Current.User.Identity.Name + "\","); // Display the Username Which is set in the session
HttpContext.Current.Response.Write("\"items\": [");
HttpContext.Current.Response.Write(items);
HttpContext.Current.Response.Write("]");
HttpContext.Current.Response.Write("}");
Response.End();
}
private string chatBoxSession(int chatbox)
{
string items = "";
if (((Hashtable)(Session["chatHistory"]))[chatbox] != null)
{ // Check the Session variable
items = ((Hashtable)(Session["chatHistory"]))[chatbox].ToString();
}
return items;
}
private void closeChat()
{
int chatbox = 1; //value of chatbox
try
{
((Hashtable)(Session["openChatBoxes"]))[chatbox] = null;
}
catch
{
}
Response.Write("1");
}
private int getIndexOf(Hashtable SessionArray, string Value)
{
// try
// {
// return SessionArray.in((object)Value);
// }
// catch
// {
return 0;
//}
}
private void chatHeartbeat()
{
//string to = Request.QueryString["UserName"].ToString();
// Session["username1"] = to; // Assign Session user name value to $from value
/* Add the Code to get the chat from the databse here and assign the result to datatable dtChat */
string ConString = ConfigurationManager.AppSettings["SiteSqlServer"];
CHATDataContext ObjDataContext = new CHATDataContext(ConString);
// var messages = ObjDataContext.GetNotRecieved(User.Identity.Name);
var q = from a in ObjDataContext.dnn_DNAiusMessage_1
where a.UserFrom == User.Identity.Name && a.Received == Convert.ToInt32(1)
select a;
// System.Collections.Generic.GenericCollection<dnn_dnaiusmessage_1> messages = ObjDataContext.GetNotRecieved(User.Identity.Name);
// System.Collections.Generic.List<dnn_dnaiusmessage_1> messages = ObjDataContext.GetNotRecieved(User.Identity.Name);
List<dnn_dnaiusmessage_1> messages = q.AsEnumerable().ToList();
string items = "";
foreach (dnn_DNAiusMessage_1 message in q)
{
if (Session["openChatBoxes"] != null && Session["chatHistory"] != null)
{
if (!((Hashtable)(Session["openChatBoxes"])).Contains(message.UserFrom) && ((Hashtable)(Session["chatHistory"])).Contains(message.UserFrom))
{
items = ((Hashtable)(Session["chatHistory"]))[message.UserFrom].ToString();
}
}
message.MessageContent = sanitize(message.MessageContent);
// Response.Write(message.MessageContent);
//items = items + "{\"s\": \"0\",\"f\": \"" + message.UserFrom.ToString() + "\",\"m\": \"" + "ggg" + "\"}, ";
//items = items + "\"s\":\"0\",\"f\":\"{" + message.UserFrom.ToString() + "}\",\"m\":\"{" + "GOOOOP" + "}\"";
items = items + "{\"s\": \"0\",\"f\": \"" + message.UserFrom.ToString() + "\",\"m\": \"" + message.MessageContent + "\"}, ";
if (Session["chatHistory"] != null)
{
if (!((Hashtable)(Session["chatHistory"])).Contains(message.UserFrom))
{
((Hashtable)(Session["chatHistory"]))[message.UserFrom] = "";
}
}
if (Session["chatHistory"] != null)
((Hashtable)(Session["chatHistory"]))[message.UserFrom.ToString()] += "\"s\":\"0\",\"f\":\"{" + message.UserFrom.ToString() + "}\",\"m\":\"{" + message.MessageContent + "}\"";
if (Session["tsChatBoxes"] != null)
((Hashtable)(Session["tsChatBoxes"]))[message.UserFrom.ToString()] = null; // Unset means clear the session value
if (Session["openChatBoxes"] != null)
((Hashtable)(Session["openChatBoxes"]))[message.UserFrom.ToString()] = message.SendTime;
}
if (Session["openChatBoxes"] != null)
{
Hashtable openChatBoxesArray = (Hashtable)(Session["openChatBoxes"]);
for (int i = 0; i < openChatBoxesArray.Count; i++)
{
int chatbox = i;
if (openChatBoxesArray[i] != null)
{
DateTime time = (DateTime)(openChatBoxesArray[i]);
string timeval = "";
TimeSpan Now = (TimeSpan)(DateTime.Now - time);
timeval = time.ToString("g:iA M dS");
string message1 = "Sent at " + timeval;
if (Now.Minutes > 180)
{
// items = items + "{\"s\": \"0\",\"f\": \"" + message.UserFrom.ToString() + "\",\"m\": \"" + message.MessageContent + "\"}, ";
items += "\"s\":\"2\",\"f\":\"{" + chatbox.ToString() + "}\",\"m\":\"{" + message1 + "}\"";
if (((Hashtable)(Session["chatHistory"]))[chatbox] != null)
{
((Hashtable)(Session["chatHistory"]))[chatbox] = "";
}
((Hashtable)(Session["chatHistory"]))[chatbox] += "\"s\":\"2\",\"f\":\"{" + chatbox.ToString() + "}\",\"m\":\"{" + message1 + "}\"";
((Hashtable)(Session["tsChatBoxes"]))[chatbox] = "0";
}
}
}
}
ObjDataContext.UpdateRecieved(User.Identity.Name);
ObjDataContext.SubmitChanges();
if (items != string.Empty)
{
items = items.Substring(0, items.Length - 1);
}
HttpContext.Current.Response.Write("{ ");
Response.Write("\"items\":[" + items + "]");
HttpContext.Current.Response.Write(" }");
Response.End();
}
Chat Application Code is not Working .Please any
one help me. problem is i am not recieving the message
it will be stored into database.but i am not getting the message in browser. please help me
|
|
|
|
|
It's very difficult to read your code,
you can get the messages from database by pulling it with given interval. you can create timer and append new messages in the panel. you can add panel inside UpdatePanel. You will not see any postback if you will use UpdatePanel.
Best luck
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
REGULAR EXPRESSION FOR CAR ENGINE IN
TWO ALPHA 2 NUMBER 2 ALPHA 4 NUMBER
|
|
|
|
|
IF YOU WRITE IN ALL CAPS, ITS LIKE SHOUTING.
PEOPLE DO NOT TAKE KINDLY TO BEING SHOUTED AT IN REAL LIFE, THE INTERNET IS NO DIFFERENT!
|
|
|
|
|
Why are you yelling at me.
My children have learned very early on that yelling is not the way to get an answer from someone. It is only a way to make them angry.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
All you need is a price and I may buy it
|
|
|
|
|
REGULAR EXPREESION FOR CAR ENGINE NUMBER
IN THIS SERIAL
TWO ALPHA TWO NUMBER TWO ALPHA FOUR NUMBER
NEED EXPRESSION FOR THIS
|
|
|
|
|
Not exactly a difficult one, but Expresso[^] will help you.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
Given the following code in an .ASPX webforms application :
try
{
Response.Redirect("somePage.aspx");
}
catch (Exception ex)
{
}
finally
{
}
I'm wondering if the code in the Finally block (or any code that might be outside of the whole try/catch) would ever be hit.
Doesn't the Response.Redirect() immediately redirect making any code that follows useless? Or do I just not understand how this works?
|
|
|
|