There are several quirky bugs that occur when the Admin trys to delete photo files if application is storing photos in Upload directory instead of in the database. There are many reasons why it's preferable to store your photo files in a web directory instead
of the SQL or SQL Express database, but that an entirely different discussion. In any event, after extensive testing of this problem here is my summary:
If photos are stored in either SQL 2005 or SQL Express Database they get added and deleted without any problems.
If, however, the photos are stored in a web directory (IE: Upload), then here's what happens:
If either a USER or ADMIN deletes a photo file BEFORE they delete the ad, it will delete the photo file from the Upload directory without any problem.
If a user just removes the ad by "unlisting" it, the photo file will NOT get deleted from the Upload directory, even if the option is checked to remove inactive ads from the database when the user deletes them. The ad itself WILL get deleted.
Now, if an Administrator deletes an ad (by selecting "remove from database") in the Administrator -> Manage Ads and Features section, the coresponding photo file will NOT get deleted from the Upload directory. Again, however, the ad itself WILL get deleted.
After examining the code, I discovered that there is some missing code from the App_Code -> BLL -> Photos.vb file. The
RemovePhotosByAdId procedure only provides code in the event that "s.StorePhotosInDatabase = True", in other words, only in the event that we have chosen to store our photos in the database. I added the missing code required to
call the "DeleteLocalPhotoFiles" procedure and when it still did not work, upon further testing, I discovered that the reason is that "fullPhotoPath" variable that the "DeleteFile()" method is using, does not point to the correct
directory. Instead of just adding the name of the upload directory ("Upload") to the root application path, it adds it to the path that the the administrator's ".aspx" page is being run from. In other words, it shows the "Upload" directory as being a subdirectory
of the "Admin" subdirectory instead of the root directory of the applicaton. I was then able to use the following Replace command to give it the correct path:
Dim fullPhotoPath As
String = Replace(GetFilePath(photoId,
False, PhotoSize.Full),
"\Admin\", "\")
After making these changes, I am now able to get the application to correctly delete the locally stored photo files. I am still having a problem with it on my hosted site however, and I am still working on it. I suspect it is a similiar
issue. It also still has a problem, both on my local server and my hosted server deleting all of the photo files when the user has downloaded more than one photo file for an ad. When I have a fix for the hosted version (as well as the multiple photo files
issue) I will post it here as well.
The category is not getting carried over from advanced search. This is a problem. To fix it in the C# version of the kit, locate the Search.aspx.cs and inside find the following code (starts around line 81) and add the line below that says "THIS IS NEW LINE"
else if (advParameters !=
null && !advParameters.SearchTerm.Equals(String.Empty))
{
// carry over just search term as regular search in category
AdvancedSearch.ImportProperties(advParameters);
// fix category behavior -- THIS IS NEW LINE
SearchTermTextBox.Text = advParameters.SearchTerm;
SetCurrentCategory(AdvancedSearch.CategoryId);
SetSearchMessage(1);
ViewState["advancedSearchInEffect"] =
false;
}
In the VB.NET version of the kit, do the same:
ElseIf (Not (advParameters
Is Nothing)
AndAlso Not (advParameters.SearchTerm.Equals(String.Empty)))
Then
' carry over just search term as regular search in category
AdvancedSearch.ImportProperties(advParameters) ' fix category behavior -- THIS IS NEW LINE
SearchTermTextBox.Text = advParameters.SearchTerm
SetCurrentCategory(AdvancedSearch.CategoryId)
SetSearchMessage(1)
ViewState("advancedSearchInEffect") =
False
Let me know if this works for you.
Hi MarcGel,
Though your solution works fine, in fact there's no need to even ImportProperties
to resolve it.
This bug occurs because the original StarterKit coder has used AdvancedSearch.CategoryId instead of
advParameters.CategoryId
So even if U do a minor change as follows the problem will be solved. Thanks
ElseIf
(Not (advParameters
Is Nothing)
AndAlso Not (advParameters.SearchTerm.Equals(String.Empty)))
Then
' carry over just search term as regular search in category
SearchTermTextBox.Text = advParameters.SearchTerm
'BugSlayer: replaced the following line, coz catg wasn't getting carried over
'SetCurrentCategory(AdvancedSearch.CategoryId) '-- old code
SetCurrentCategory(advParameters.CategoryId) '-- new code
SetSearchMessage(1)
ViewState(
"advancedSearchInEffect") =
False
"Our truest life is when we are in dreams awake." - Henry David Thoreau
There is an issue with the Starter Kit in adding ads as a user created through the Application Configuration Tool. Seems the starter kit does not recognize the users added through the application configuration tool. So you will have to create the user through
the starter kit and then maybe use the Applicaiton Config tool to give admin user rights to the required user.
The approval date does not get set and the expiration date does not get updated when an ad is approved (when the site is set up to require admin approval before an ad is published):
o When an ad is approved, only the status gets updated -- not the DateApproved and not the ExpirationDate
- Example: If an ad is approved 3 days after it is first created, the ad is already considered 3 days old
o Ads listed on the Search page use only the DateCreated value -- it should use DateApproved when appropriate.
I'm working on fixing this, but it's complicated...
All Most All Classifieds Website Opens Very Slow, It also takes enough time to move from one to other pages also.
I must have seen almost all Classified Site Posted in this classified Section.
I am really sorry to see that, none of the Classified Opens faster. All the Classified site takes more than enough time to load.
It is also important to see that All this sites are hosted on different reputed hosting companies, with good reputation and speed.
All this hosting companies cannot be wrong.There is SOME BUG somewhere in the classified Code.
I was suggested in the past to make use of HTML controls wherever possible and to stop Using ViewState.
Orkut.com, which is considered to be the fastest site and 5th busiest site, works with the above rules. Its really fast.
Myspace also opens reasonably fast.
With my connection, i can open many sites faster, but NOT Classified.
I would appreciate, if someone finds the bug and gives us a solution .
Thanks
Paggy4u
-----------------------------------------
Working with Dynamic Languages
To see what i have done with it see http://OKValleyRally.com I combined the club site and classified site. almost everything is good ecxecpt my categories do not update how many ads are in each category.
In order for us to troubleshoot your app, U'd need to shed some light on it's architecture...coz its a major custom job (not a typical starter kit) hence impossible to simulate at our end.
First question....
Do the two apps Classifeds & Clubsite exist as separate apps (in subdomains) with shared membership provider and look-alike theme/skins?
OR
have U physically combined all code-files from Classifeds & Clubsite in to a single app and manually sorted out differences/discrepancies etc.
I'm guessing/leaning mostly towards the 2nd answer...but always better to confirm.
Thanks
P.S. I don't mean to nitpick, but ideally U should start a separate thread called 'OKValleyRally customization' etc. or something...coz this bug is not related to the pure form of the original Starter Kit per-se. It'll keep things better organized and Ur
issue will get the attention it deserves rather than being buried under a slew of other bugs.
"Our truest life is when we are in dreams awake." - Henry David Thoreau
ASPMAN55
Member
12 Points
3 Posts
Admin Cannot Delete Photo Files When Stored in Upload Directory
Nov 24, 2006 09:42 PM|LINK
There are several quirky bugs that occur when the Admin trys to delete photo files if application is storing photos in Upload directory instead of in the database. There are many reasons why it's preferable to store your photo files in a web directory instead of the SQL or SQL Express database, but that an entirely different discussion. In any event, after extensive testing of this problem here is my summary:
If photos are stored in either SQL 2005 or SQL Express Database they get added and deleted without any problems.
If, however, the photos are stored in a web directory (IE: Upload), then here's what happens:
If either a USER or ADMIN deletes a photo file BEFORE they delete the ad, it will delete the photo file from the Upload directory without any problem.
If a user just removes the ad by "unlisting" it, the photo file will NOT get deleted from the Upload directory, even if the option is checked to remove inactive ads from the database when the user deletes them. The ad itself WILL get deleted.
Now, if an Administrator deletes an ad (by selecting "remove from database") in the Administrator -> Manage Ads and Features section, the coresponding photo file will NOT get deleted from the Upload directory. Again, however, the ad itself WILL get deleted.
After examining the code, I discovered that there is some missing code from the App_Code -> BLL -> Photos.vb file. The RemovePhotosByAdId procedure only provides code in the event that "s.StorePhotosInDatabase = True", in other words, only in the event that we have chosen to store our photos in the database. I added the missing code required to call the "DeleteLocalPhotoFiles" procedure and when it still did not work, upon further testing, I discovered that the reason is that "fullPhotoPath" variable that the "DeleteFile()" method is using, does not point to the correct directory. Instead of just adding the name of the upload directory ("Upload") to the root application path, it adds it to the path that the the administrator's ".aspx" page is being run from. In other words, it shows the "Upload" directory as being a subdirectory of the "Admin" subdirectory instead of the root directory of the applicaton. I was then able to use the following Replace command to give it the correct path:
Dim fullPhotoPath As String = Replace(GetFilePath(photoId, False, PhotoSize.Full), "\Admin\", "\")
After making these changes, I am now able to get the application to correctly delete the locally stored photo files. I am still having a problem with it on my hosted site however, and I am still working on it. I suspect it is a similiar issue. It also still has a problem, both on my local server and my hosted server deleting all of the photo files when the user has downloaded more than one photo file for an ad. When I have a fix for the hosted version (as well as the multiple photo files issue) I will post it here as well.
BugSlayer
Member
246 Points
58 Posts
Re: Advanced Search Flaw . . .
Jan 25, 2007 09:14 PM|LINK
Hi MarcGel,
Though your solution works fine, in fact there's no need to even ImportProperties to resolve it.
This bug occurs because the original StarterKit coder has used AdvancedSearch.CategoryId instead of advParameters.CategoryId
So even if U do a minor change as follows the problem will be solved. Thanks
ElseIf
(Not (advParameters Is Nothing) AndAlso Not (advParameters.SearchTerm.Equals(String.Empty))) Then
' carry over just search term as regular search in categorySearchTermTextBox.Text = advParameters.SearchTerm
'BugSlayer: replaced the following line, coz catg wasn't getting carried over 'SetCurrentCategory(AdvancedSearch.CategoryId) '-- old codeSetCurrentCategory(advParameters.CategoryId) '-- new code
SetSearchMessage(1)
ViewState(
"advancedSearchInEffect") = Falsesampathd
Member
24 Points
12 Posts
Re: Bug - When creating sub category
Feb 21, 2007 07:04 AM|LINK
Hi,
There is an issue with the Starter Kit in adding ads as a user created through the Application Configuration Tool. Seems the starter kit does not recognize the users added through the application configuration tool. So you will have to create the user through the starter kit and then maybe use the Applicaiton Config tool to give admin user rights to the required user.
HTH,
Cheers,
Sampath D.
mattbug
Member
535 Points
146 Posts
Approval Process - Approval Date not getting used; Expiration Date inaccurate
Feb 21, 2007 01:25 PM|LINK
The approval date does not get set and the expiration date does not get updated when an ad is approved (when the site is set up to require admin approval before an ad is published):
o When an ad is approved, only the status gets updated -- not the DateApproved and not the ExpirationDate
- Example: If an ad is approved 3 days after it is first created, the ad is already considered 3 days old
o Ads listed on the Search page use only the DateCreated value -- it should use DateApproved when appropriate.
I'm working on fixing this, but it's complicated...
rfurdzik
Contributor
3439 Points
1731 Posts
Re: The code does not work
Feb 24, 2007 01:04 AM|LINK
I have similar problem. It works fine on the server, but not on local machine. It is using the same database.
MemberID is not getting retrieved. It returns 0!
ShowAd.aspx.cs:
protected void SaveAdButton_Click(object sender, EventArgs e)
{
if (User.Identity.IsAuthenticated)
{
AdsDB.InsertSavedAd(AdId, Profile.MemberId);
SetActivePanel(AdSavedPanel);
}
else
{
FormsAuthentication.RedirectToLoginPage();
}
}
This leads to foreign key validation breaking stopping the program with error...
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
rfurdzik
Contributor
3439 Points
1731 Posts
Re: The code does not work
Feb 24, 2007 02:58 AM|LINK
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
rfurdzik
Contributor
3439 Points
1731 Posts
Layout bug in Firefox
Feb 24, 2007 03:01 AM|LINK
Steps to reproduce:
1)Try to go to this page in firefox:
http://localhost/mysite/ShowAd.aspx?id=11
2) Now click refresh
You will see everything below search control will move down...
Anybody knows how to fix it?
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
paggy4u
Contributor
3017 Points
774 Posts
Slower Classifieds Sites
Mar 13, 2007 03:51 AM|LINK
All Most All Classifieds Website Opens Very Slow, It also takes enough time to move from one to other pages also.
I must have seen almost all Classified Site Posted in this classified Section.
Orkut.com, which is considered to be the fastest site and 5th busiest site, works with the above rules. Its really fast.I am really sorry to see that, none of the Classified Opens faster. All the Classified site takes more than enough time to load.
It is also important to see that All this sites are hosted on different reputed hosting companies, with good reputation and speed.
All this hosting companies cannot be wrong.There is SOME BUG somewhere in the classified Code.
I was suggested in the past to make use of HTML controls wherever possible and to stop Using ViewState.
Myspace also opens reasonably fast.
With my connection, i can open many sites faster, but NOT Classified.
I would appreciate, if someone finds the bug and gives us a solution .
Thanks
-----------------------------------------
Working with Dynamic Languages
tinwistle
Member
4 Points
3 Posts
How do i post my bug to this thread? Help I have trouble with the categories not updating how ma...
Mar 15, 2007 08:59 AM|LINK
Thank you
BugSlayer
Member
246 Points
58 Posts
Re: How do i post my bug to this thread? Help I have trouble with the categories not updating ho...
Mar 15, 2007 01:53 PM|LINK
Hi Tinwistle,
In order for us to troubleshoot your app, U'd need to shed some light on it's architecture...coz its a major custom job (not a typical starter kit) hence impossible to simulate at our end.
First question....
Do the two apps Classifeds & Clubsite exist as separate apps (in subdomains) with shared membership provider and look-alike theme/skins?
OR
have U physically combined all code-files from Classifeds & Clubsite in to a single app and manually sorted out differences/discrepancies etc.
I'm guessing/leaning mostly towards the 2nd answer...but always better to confirm.
Thanks
P.S. I don't mean to nitpick, but ideally U should start a separate thread called 'OKValleyRally customization' etc. or something...coz this bug is not related to the pure form of the original Starter Kit per-se. It'll keep things better organized and Ur issue will get the attention it deserves rather than being buried under a slew of other bugs.