|
I understand the Web.config
But if I change a variable in the appSettings section on the server, then it will update live and users sessions are not lost - they get the new value and their session is maintained.
But my question is about storing 'complex' types.
|
|
|
|
|
boy.pockets wrote: But if I change a variable in the appSettings section on the server, then it will update live and users sessions are not lost - they get the new value and their session is maintained.
I believe, that not going to happen.
boy.pockets wrote: But my question is about storing 'complex' types.
All serializable collections can be stored in XML files.
|
|
|
|
|
Web.config is a Configuration file which help in setting up of a website. Change the Web.config at runtime will restart the application (i.e) all the session information will lose. You have to start the application again.
The storing your 'Complex' collections in Web.config which is changing at runtime is a bad idea. Try to use XML files.
|
|
|
|
|
Thanks for taking the time to answer again.
I hear what you are saying about xml files and will look into it (i know you can specify an 'external' file to extend the appSettings section).
my experience is at odds with what you are saying about changing Web.config appSettings entries at runtime and loosing session information. Because I believe I am already doing it (I might be mistaken). Perhaps you could point me to some articles/doco backing up your point of view?
|
|
|
|
|
Here is the answer i was looking for:
mysteries of configuration
anyone making a medium-large scale web site should know about this
|
|
|
|
|
Hi,
I've custom error mode set to "On" and defualt redirect to error.htm in my web.config. In all other cases of error it displays the error.htm page. When sql server was down it displayed the error, "Runtime error , please turn off custom error mode in web.config to view error."
How do i avoid even this kind of runtime error getting displayed to end user. Please calrify.
Thanks,
Priya
|
|
|
|
|
maybe recreating the error and looking at the Page_Error method where you can handle the error manually.
as an aside:
for customErrors set mode = "RemoteOnly"
that will mean that externals will not see the error, but you will be able to see the error from the local box.
|
|
|
|
|
Hi All
Slowly getting through my 1st asp.net page but need to pick your brains (again!)
Basically I'm pulling data from an excel sheet, one of the thing's I'm doing with the data is making a url link, if there's text in column 2 then that's to be the text for the link, if there isn't then the text in column 1 is the text for the link.
Problem is, as there doesn't necessarily have to be text in column 2 I'm getting a dbnull error. Below is my function and the asp code refering to that function. I know I need to put some error handeling but my big question is where? Is it within the function or within the asp link?
Function MakeLinkText(ByVal name As String, ByVal description As String) As String
If description = "" Then
name = name
else
name = description
end if
return name
End Function
<asp:TemplateField HeaderText="LinkText"><ItemTemplate><%# MakeLinkText(Container.Dataitem("title"), Container.Dataitem("refer to")) %></ItemTemplate></asp:TemplateField>
I did try on error resume next within the function but still got the error (I realise thats very bad practice, I was just trying to narrow down the cause of the error.
Appreciate a point in the right direction.
Rgds
gerryR
|
|
|
|
|
Try if string.IsNullOrEmpty(description), assuming this is the point of error. In C#, you can do ?? string.Empty to turn null into an empty string.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
In Visual Basic you can test for DbNull using
If IsDbNull(whatever) Then...
Howver, nb that you will need to re-write your function without explicitly defining the type - eg
Assuming "name" is never null, but description might be:
Function MakeLinkText(ByVal name, ByVal description) As String
If IsDbNull(description) Then
Return CStr(name)
Else
Return CStr(description)
End If
End Function
|
|
|
|
|
Thanks once again Phil, workes perfectly!
One question, if I leave the CStr out it still seems to work, is there some other reason for having it in other than just good code practice? (not that that's not reason enough!)
Thanks again
gerryR
|
|
|
|
|
Well, not really... only that as the type is not explicitly defined it just takes care of any situation when you might call the same function from somewhere else with different data types...
|
|
|
|
|
yes ... if you make Option Strict on then CStr is necessary....
Abhishek Sur
|
|
|
|
|
Folks
Iam doing an application which is an EXE.What I want to achieve is, upon clicking on that exe in desktop,it should automatically check whether the user in windows authentication ( User ID and Password used in windows login )is there in DB or not. If the username and password of windows matches that in DB, then the user should be given access and directly the the Form( Simple form with a button I design for test purpose) I design should open. Else, it should display an message that " You are not the authenticated user for to access this application".
Like, there can be many users logging into a windows system. but only selected users have the access to that particular application. It should be done without knowledge of user at the backend.Only in failing cases, it should display the message " You are not the authenticated user for to access this application".
else it should go to that Form page I have designed.
Please please, some folks help me in this as its very very urgent and important ....I will be very thankful to you ....Please paste the entire code with some comments ( As Iam new to this )..
|
|
|
|
|
rajanarayanansabarish wrote: Please paste the entire code with some comments
www.rentacoder.com[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
rajanarayanansabarish wrote: Please please, some folks help me in this as its very very urgent and important
But not important enough for you to post in the right forum ? This is not an ASP.NET question.
rajanarayanansabarish wrote: ( As Iam new to this )..
Then why do you have a task that is 'very very urgent' ??? Have you taken a paid job you can't handle ? This doesn't sound like homework to me.
rajanarayanansabarish wrote: Please paste the entire code with some comments
Code Project has a jobs area, you should perhaps subcontract the work you can't do. Although, it sounds like that will be all of it, and I'd guess you have no margins to subcontract, you're in fact an example of why outsourcing doesn't work. b/c incompetent people bid low on jobs they can't do, and hope for sites like this to do the work for them.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: have a task that is 'very very urgent' ??? Have you taken a paid job you can't handle ?
Probably so. Too bad the moron who hired him hasn't seen his post.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
and get out of programming.
Blog link to be reinstated at a later date.
|
|
|
|
|
rajanarayanansabarish wrote: .Please paste the entire code with some comments
I wont do that.
Begin by yourself to write your application and in any specific problem we can help you.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hi
I have a probleman with PostBackTrigger.
There is a button in my page asp.net with this code, with FileUpload Component.
<asp:linkbutton id="lbtIncluir" runat="server" cssclass="label_negrito" text="Incluir" onclick="lbtIncluir_Click" visible="False" xmlns:asp="#unknown">
<triggers> <asp:postbacktrigger controlid="lbtIncluir" xmlns:asp="#unknown">
<triggers>When execute the button lbtIncluir the event lbtIncluir_Click is execute.
When execute the button, the imagem load perfect, but if I press F5 to refresh the page, it is not running PostBack and running the event again lbtIncluir_Click not even being called in Page_Load. Do you know why and how to solve?
Someone could help me?
Thanks.
|
|
|
|
|
Marcos Antonio de Aguiar Junior wrote: but if I press F5 to refresh the page, it is not running PostBack
That is simple. Because it is not a postback.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
So why is he running event (lbtIncluir_Click) again if I am not calling in the PostBack?
|
|
|
|
|
Can anyone point me in the right direction for a good article explaing the different ways to update your files to the server. E.g. binding a DLL, saving the file directly to the server etc
thanks
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Are you looking for an article on Web Publishing?
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
you can try to Explore CopyWeb Tool and Publish WebSite . Both are many features to update file on server .
|
|
|
|