Click here to Skip to main content
15,867,750 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Getting the above issue in the below code:confused:

Cache.Insert("FileCache", File.ReadAllText(@"h:\Dictionary.txt"), new CacheDependency(Server.MapPath(@"h:\Dictionary.txt")));


Please help :doh:

[edit]inline code converted to code block; "ignore HTML in text" option turned off - OriginalGriff[/edit]
Posted
Updated 27-Jan-11 5:47am
v2

here is your issue
CacheDependency(Server.MapPath(@"h:\Dictionary.txt")));

Server.MapPath takes a virtual path and converts it to physical path for you. But you are giving it a physical path, i.e "h:\Dictionary.txt"

Try this
CacheDependency(@"h:\Dictionary.txt");

In order for this to work, you ASP.NET need to have an access to that folder. You set the access in the folder security tab on the property page.
 
Share this answer
 
Comments
Dhanamanikandan 27-Jan-11 12:19pm    
thank you.. now am able to run
When you have code that does a ton of things, try breaking it in to little steps, such as storing the return value of Server.MapPath and then using that variable. That way, you can work out which part is causing the issue.
 
Share this answer
 

<<code>/strike>
gg
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900