c# - Change Background image every visit -
i have 50 background images site. looking randomly present user different 1 every visit. mean surf through site same background image during visit.
after close browser , re-visit or come , visit later, presented new random background image. don't need save on previous background image was, random new 1 each new visit site.
not sure can done c#, javascript, jquery or css.
edit: using asp.net 4.0 c# web app. thanks
keep in session. pick @ random when it's not in session, stay same long they're @ site -- , next time come back, they'll new one.
for example (my c# little rusty):
public getbackground (httpsessionstate session) { string bg = (string) session["session.randombg"]; if (bg == null) { // pick random bg & store it. bg = "pick one"; session["session.randombg"] = bg; } return bg; }
hope helps!
Comments
Post a Comment