|
Is it correct to read from web.config file in the following way? i am using asp.net 2.0 VS 2005.I get the following error
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
anmar.SharpWebMail.UI.Login.Login_Click(Object sender, EventArgs args) in login.cs:75
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
The point where the error is shown is
int login_mode = (int)Application["sharpwebmail/login/mode"];
Are application variables available in asp.net 2.0
|
|
|
|
|
sankar.K wrote: Are application variables available in asp.net 2.0
Yes, but set them in global.asax, not web.config
|
|
|
|
|
Consider i have a web.config like this
<configuration>
<configsections>
<sharpwebmail>
<general
default_lang="en"
="" title="[general title] configuration setting">
<login
title="[login title] configuration setting"
="" mode="1" append="" serverselection="auto" enablequerystringlogin="false">
How do i get the value of mode in login section in my code?
|
|
|
|
|
I think you can use something aliong the lines of
ConfigurationSettings.SectionName("KeyName")
Try googling "asp.net 2.0 web.config reading" or some such...
|
|
|
|
|
I want to close my page and open another url outside of my local pages.
example
page1.aspx(close)
www.google.com(open)
when i use the server.Transfer it wont do it?
Thanks in advance.
|
|
|
|
|
you can't server.transfer to a file outside of your web app
brsecu wrote: I want to close my page and open another url outside of my local pages.
?? ...just link to it...
|
|
|
|
|
Yes but how. I know it seems like a simple question but I want to do it out of the aspx.cs code not html. How do i link to it.
|
|
|
|
|
Response.Redirect("http://www.google.com");
for example... is that what you want?
|
|
|
|
|
|
Hi,
after registering the user, I ask him to confirm his membership, and after he confirm I use this code to approve him (before he couldn't enter the site):
<br />
MembershipUser User = Membership.GetUser(username);<br />
User.IsApproved = true;
but unfortunately, it doesn't approves him, it changes its value only during the debugging.
Does anybody now, why?
Thank you
|
|
|
|
|
You have a local variable called User that you changed. That doesn't affect the membership database. You need to save the user after you have changed the property to true.
Hope that helps.
Ben
|
|
|
|
|
Thank you,
could you tell me how to do that?
|
|
|
|
|
System.Web.Security.Membership.UpdateUser(User)
Ben
|
|
|
|
|
I've seem any web sites where the pages (.aspx) is in a directory and the code behind (.aspx.cs) is in other directory. Then, there are .dll named with the project name . For me, this structure of directory seems hide code behind and too seems to be strongly secure. I'm worth? Then, how it work? I don't know how to create a web site so. I've created my web sites with .aspx and .aspx.cs together, i.e., in the same directory.
Thanks in advance.
Clucster
|
|
|
|
|
I'm not sure if this is what you're on about, but it sounds like precompilation is at work. Here is a link:
http://www.odetocode.com/Articles/417.aspx[^]
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
Thanks so much. It's really it.
Clucster
|
|
|
|
|
You're welcome.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
hi everyone
please give me hint how i can do following:
I have inserted data into database using textboxes and database gets updated. Each record contains 5 fields. When I submit data from textboxes I want next page appear and show data.
But wait ......... i need each record as below
Name: abc
address: def street
phone: 1234
email: a11111@gmail.com
above is one record.
I want to if i feed new data in form text boxes. This new page show block of data of each record (new at the top) as given above.
Please guide me how can i do that ... if any article in this regard on code project please mention.
Thank You.
Destined to Win
|
|
|
|
|
hi friend.
how to put checkbox in gridview.
How to delete multiple item from gridview which i check..
plz send me complate information regarding this topic.
thanking you,
Imagine the I.T
|
|
|
|
|
Ajay58886 wrote: how to put checkbox in gridview.
Use checkbox column. Why don't you Google[^] it before asking ?
|
|
|
|
|
He's done this before. (Ask a general question rather than doing the work himself.)
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
Hi,
I have two problems.
Problem 1:
I have an internal LAN web server which one provides file attachments.
I'd like to cache the requestet file on the web server my asp.net site is hosted on.
Is it possible to copy an file from one webserver to another via code?
Problem 2:
Now I'd like to provide the file download for the user.
I know, that a direct link is one possiblity, but I'd lik to
start the file download via code, too.
Is ther any Method or something which handle this?
thank in advance
regards pdluke
|
|
|
|
|
|
Hi,
thank for the fast response.
I've tried the method from the Microsoft support page, tha you have linked.
The Problem is that the exception says, that URI-Fromats can't be handled.
regards pdluke
|
|
|
|
|
pdluke wrote: Is it possible to copy an file from one webserver to another via code?
I think there is no direct method available. You can do in other way, webserver where files to be copied can request to the file located on this server using WebClient classes DownloadFile() method.
pdluke wrote: Now I'd like to provide the file download for the user.
I know, that a direct link is one possiblity, but I'd lik to
start the file download via code, too.
Is ther any Method or something which handle this?
Just do Response.Redirect() to the file you want to get downloaded. If file extension is not mapped with any ISAPI module, then browser will prompt Save dialogbox.
|
|
|
|