|
If I didnt declare it as static, then its value becomes empty in another function.
ie,
I declared it outside all the function ,
In Page_PreInit - declared the fields,
In btnAdd_Click - wrote function to add rows
Therefor if I didnt declare it as static then the fields are not accessible in btnAdd_Click function.
Shivanandan C V
|
|
|
|
|
The variables are automatically destroyed once they are out of there scope.
If u are talking abt object.Let the asp.net garbage collector handle it for u.
|
|
|
|
|
Why you want this.Actually for any value type variable you does need to care because thaey are allocated n stack so they will be according to the scope of that variable.
For reference type vaiable also ,the garbage collector take care of all this,you can also call garbage collector by your own but it is not advisable as per Microsoft.You can do one thing,if reference variablle if you don't need any more ,you can assign null it to you,it'll help gc.
Cheers!!
Brij
|
|
|
|
|
Brij wrote: if reference variablle if you don't need any more ,you can assign null it to you,it'll help gc.
No.
|
|
|
|
|
hi all ,
Created a web control for menu where i am trying to set the property by passing hashtable.
Dont know y it throws error
|
|
|
|
|
if(NoClearInformation())
NoHelp() Seriously, check all your objects are instantiated.
|
|
|
|
|
plz dont mind,
can u suggest wht info do u need.
|
|
|
|
|
The error which you said will happen only when you try to use an object which is not initialized.
|
|
|
|
|
Thx navaneeth for the soln..
Actually i was trying to place the control in the master page content holder..
Thus was getting the error.
the Problem is solved.
|
|
|
|
|
Hello guys,
I'm using system.IO.File.Exist to check to see if the file exist and if it does. i delete it by calling File.Delete(C:\"MYFile.txt");
if(File.Exist)
{
File.Delete(C:\"MYFile.txt");
}
This works if as long as the file is not opened (i'm doing some processing within the file). But when i try to delete it after processing, it errors out. Apparently the process is not releasing this file and that's why it throws an exception that says that the file is being used by another process.
The file class doesnt provide a mechanism to see if the file is currently open or not so that I will only call Delete on the file if it is not open. Or how dow I explicitly close the file?
Thanks for your help in advance.
Tina
|
|
|
|
|
Tina P wrote: i'm doing some processing within the file
Are you not closing the file after use?
Tina P wrote: says that the file is being used by another process.
I don't think there is no other way to know the file in use other than catching the exception raised by File.Delete.
|
|
|
|
|
After processing the file make sure that you are disposing the filesystem objects properly. If you close and dispose the objects, you will be able to delete it without any problem.
*jaans
|
|
|
|
|
Thanks guys, Yes I'm using a text field parser (Microsoft.VisualBasic.FileIO namespace) and i guess it was not getting disposed off properly eventhough I was using the using syntax
Thanks
Tina
|
|
|
|
|
Tina P wrote: Apparently the process is not releasing this file and that's why it throws an exception that says that the file is being used by another process.
Can you please put the line of code ? are you using Process any where of the code ?
|
|
|
|
|
You are doing some processing in the file after opening it.For that are you creating an object of StreamWriter or some other class? If yes the you need to close/dispose that object
|
|
|
|
|
I ran into a similar issue. Turns out that the code runs faster than the OS. There was a short lag between the code closing the file and the OS releasing the open handle on it. I wrote a loop that would attempt to delete every 1/10 of a second or so for a few seconds until either the file was deleted or the expired time passed.
|
|
|
|
|
Interesting...all I had to do was to explicitely close those three readers that I was using in combination by calling .Close() on them.
|
|
|
|
|
Hi all.
I have a simple urlrewriter.
I want to rewrite some path such as mysite/Sale to a special page with parameter like mysite/Find.aspx?y=sale
But when I rewrite HttpCuntex.Request to page find.aspx it raise an error:
Error 404 page not found
can not find mysite/sale/find.aspx?s...
whats problem?
sepel
|
|
|
|
|
sepel wrote: mysite/sale/find.aspx
Is that file exist in mysite/sale path?
|
|
|
|
|
Thanks for your rplay.
No.The
/sale path is virtual.
I want to use some virtual path such as:ForRent,Sale,Apartemant..
sepel
|
|
|
|
|
The error message is straight forward. Well, where is this find.aspx resides? Can you show the code you used for rewriting?
|
|
|
|
|
public class SimpleRewriter : System.Web.IHttpModule
{
..
void context_BeginRequest(object sender, EventArgs e)
{
string newUrl = UrlEngine.Engine.ToRealUrl(_application.Context.Request);
HttpContext.Current.RewritePath(newUrl, true);
}
}
If _application.Context.Request be
mySite/Sale
newUrl get
/Find.aspx?type=Sale value.
Find.aspx is in Root Directory:mySite/Find.aspx
sepel
|
|
|
|
|
sepel wrote: HttpContext.Current.RewritePath(newUrl, true);
A guess. Try passing false to RewritePath method?
HttpContext.Current.RewritePath(newUrl, false);
|
|
|
|
|
It rises error yet:
Server Error in '/MySite' Application.
--------------------------------------------------------------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies)
could have been removed, had its name changed, or is temporarily unavailable.
Please review the following URL and make sure that it is spelled correctly.
Requested URL: /MySite/Sale/find.aspx
I think i must change /MySite/Sale/find.aspx to /MySite/find.aspx .
It means i must rewrite Relative Path of httpCuntex.But I don't know how?
sepel
modified on Tuesday, January 13, 2009 4:54 AM
|
|
|
|
|
Hi!
I have this strange requirement.
I need to restrict users to a website from certain machines. MAC address is stored in the database and should be validated before authenticating the username/password.
Can you provide me any suggestions about how to do this?
I have been told to create a dll and call it from javascript. Is this possible or what?
Any help will be highly appreciated.
Thanks..
|
|
|
|