Showing posts with label existing. Show all posts
Showing posts with label existing. Show all posts

Monday, March 26, 2012

Trouble editing HTML Elements version 0.6

Hi
I just encountered something very weird. I opened an existing aspx fileto make some changes. When I click on an HTML element, such as a textbox, I get the open squares that say it is selected. The Propertieswindow opens up on the right but when I try to make any changes in thatwindow, the open squares become gray squares around the HTML element.Certain properties (e.g. Type) can be changed. Others such as ID cannot be changed. However I can go into the HTML code and make thechanges there. I am using version 0.6 of ASP.NET.
Any ideas on what happened? If it helps, I am working on the Guest Book example in Chapter 10 of Mike Pope's starter book.
Danny Low

version 0.6 of ASP.NET


As far as I know there has never been a ver. 0.6 of Asp.Net. You are either using ver. 1.0, 1.1 or 2.0. Are you perhaps talking about some kind of development tool here, like Visual Studio?

As far as I know there has never been a ver. 0.6 of Asp.Net.
When you ask for version number with Help->About the window thatpops up says version 0.6 build(812). This is what I downloaded from theasp.net download section.
Danny Low

What window is this? Asp.Net is part of the .NET Framework and does not come with an Interface. There are three versions of .NET; 1.0, 1.1 and 2.0. Is it Web Matrix your are referring to??
Yes, it is Web Matrix that I am referring to. All I did was save myaspx file at a convenient stop point and shut down my system for thenight. The next day when I resumed working on the sample program, I noticed the weird behavior of not being able to edit some propertiesof the page elements when in the Design mode. And it is not just theexisting elements but any new elements that I add to the page.
Danny

Trouble opening an existing web application

I have a copy of an existing project saved to a disk. However, I am unable to open through Visual Studios.Net. I created a new virtual directory through IIS and still cannot get it to open up. I receive an error saying that some of the components are not installed on the specified web server. Any help would be greatly appreciated.Could you please post the error message here?
Visual Studio cannot create or open the application. The likeliest problem is that required components are not installed to the local web server. Run visual studio .NET setup and add the web development tool.

Saturday, March 24, 2012

Trouble with changing a value in a cookie.

I wanted to change a value in a existing cookie. I read the old value, modify it and to write the new value in the old cookie. Here is the code:

public bool SetCookie(string cookiename, string cookievalue, int iDaysToExpire) //create the cookie
{
try
{
HttpCookie objCookie = new HttpCookie(cookiename);
Response.Cookies.Clear();
Response.Cookies.Add(objCookie);
objCookie.Values.Add(cookiename, cookievalue); // adding the value to the cookie
DateTime dtExpiry = DateTime.Now.AddDays(iDaysToExpire); //expires
Response.Cookies[cookiename].Expires = dtExpiry;
}
catch (Exception e)
{
return false;
}
return true;
}

public string GetCookie(string cookiename)// method which gives the value from the cookie
{
string cookyval = "";
try
{
cookyval = Request.Cookies[cookiename].Value;
}
catch (Exception e)
{
cookyval = "";
}
return cookyval;
}

protected void Page_Load(object sender, EventArgs e)
{

String t, s,t1;
int i = 0;
s = "";
t = "";

t = GetCookie("test");//reading the cookie
//removing the name and getting the value
try
{
lbl1.Text = t; //
t1 = t.Remove(0, 9);
i = Int32.Parse(t1);
i = i + 1; //the value is modified
}
catch (Exception w) { lbl3.Text = "Convert isnt working."; }
s = Convert.ToString(i);

//writing the new value in the cookie
SetCookie("test", s, 1);

//testing to see if the new value is written
t1 = GetCookie("test");
lbl2.Text = s;
lbl3.Text = t1;
}
}What is your question, exactly? This code re-sets the cookie each time it runs. It seems to return exactly what you're setting it to ("test=0"). (Is that the value that you want it to have?)