Thursday, March 29, 2012
Newbie -- Page_Load( ) fires twice if image is added to Login page
I'm using Visual Studio 2005 + ASP.NET and C#
I have a login.aspx page with AutoEventWireup set to FALSE (also added to
top level Web.Config, and set to false)
With a "template" loginCtl the Page_Load( ) event fires once.
As soon as I add an ImageCtl or just drag an image using the designer, onto
the login page and then run it, I'm seeing the Page_Init( ) and Page_Load( )
functions being fired twice.
If I remove the image, then these methods are only fired once.
Any ideas?
I am setting the event delegate like this in my login.aspx.cs file:
protected override void OnInit( EventArgs e )
{
this.Load += new EventHandler( Page_Load );
}
protected void Page_Load( ... etc.
Thanks for any tips,
FrankThis isn't a direct answer, but I personally avoid that this.Load += new
EventHandler(Page_Load) stuff that the wizard puts in like the plague. The
reason being is that I subclass pages a lot, and when you depend on wiring
up events, you can run into issues where a subclass won't call the base
initializer, or the listeners get added in an order that prevents proper
handling (I'd have to dig up an example, but I had issues with Page_Load
never firing at all). Since you're overriding OnInit just to wire up an
event handler, I'd just override OnLoad and see if that might prevent the
double-hit (plus, you're plugging into the vtable instead of having to deal
with event firing/delegate calling)
Newbie -- Page_Load( ) fires twice if image is added to Login page
I'm using Visual Studio 2005 + ASP.NET and C#
I have a login.aspx page with AutoEventWireup set to FALSE (also added to
top level Web.Config, and set to false)
With a "template" loginCtl the Page_Load( ) event fires once.
As soon as I add an ImageCtl or just drag an image using the designer, onto
the login page and then run it, I'm seeing the Page_Init( ) and Page_Load( )
functions being fired twice.
If I remove the image, then these methods are only fired once.
Any ideas?
I am setting the event delegate like this in my login.aspx.cs file:
protected override void OnInit( EventArgs e )
{
this.Load += new EventHandler( Page_Load );
}
protected void Page_Load( ... etc.
Thanks for any tips,
FrankThis isn't a direct answer, but I personally avoid that this.Load += new
EventHandler(Page_Load) stuff that the wizard puts in like the plague. The
reason being is that I subclass pages a lot, and when you depend on wiring
up events, you can run into issues where a subclass won't call the base
initializer, or the listeners get added in an order that prevents proper
handling (I'd have to dig up an example, but I had issues with Page_Load
never firing at all). Since you're overriding OnInit just to wire up an
event handler, I'd just override OnLoad and see if that might prevent the
double-hit (plus, you're plugging into the vtable instead of having to deal
with event firing/delegate calling)
Newbie - Problem Loading SLN files.
I am having a problem that is driving me crazy.
I have Windows 2000 Professional, Visual Studio Professional, IIS installed
and running...
I am reading ASP.NET Developer's JumpStart by Paul Sheriff and Ken Getz.
I've downloaded the examples and now want to try some of them out.
In VS, I go to the File Menu and Select, Open Solution. I go to the
directory that the installer put the book's files and select the SLN file.I
then get the following error:
Unable to get the project file from the Web Server. Unable to open Web
Project 'JumpStart/VBLanguage.' The Web 'JumpStart/VBLanguage' located
on server 'http://localhost/' does not exist.
In IIS, their is a virtual directory for JumpStart. I've tried creating one
for VBLanguage but I still am getting errors.
I then tried just opening the Project. I had to use a URL
(http://localhost/jumpstart/vblanguage/vblanguage.vbproj) and I can open it,
but I get the message: "You do not have permission to make changes to this
document. Do you want to open a read-only copy?"
I answer Yes, but I still get the error that it is unable to get the project
file from the Web Server.
I can't reproduce exactly what I did before, but at one point I think I made
my own Solution file and added everything, but I could not view any of the
pages in Design view.
I just want to learn this stuff. I've spent too long just trying to open a
file and no time reading and learning. It had been very frustrating (thanks
for letting me vent).
Thank you for any help you can provide.
-RobI think you need to contact either Paul Sheriff or Ken Getz for your answer.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Rob G" <gumbatman@.hotmail.com> wrote in message
news:100t3elpo11ir12@.corp.supernews.com...
> Hi All,
> I am having a problem that is driving me crazy.
> I have Windows 2000 Professional, Visual Studio Professional, IIS
installed
> and running...
> I am reading ASP.NET Developer's JumpStart by Paul Sheriff and Ken Getz.
> I've downloaded the examples and now want to try some of them out.
> In VS, I go to the File Menu and Select, Open Solution. I go to the
> directory that the installer put the book's files and select the SLN
file.I
> then get the following error:
> Unable to get the project file from the Web Server. Unable to open Web
> Project 'JumpStart/VBLanguage.' The Web 'JumpStart/VBLanguage'
located
> on server 'http://localhost/' does not exist.
> In IIS, their is a virtual directory for JumpStart. I've tried creating
one
> for VBLanguage but I still am getting errors.
> I then tried just opening the Project. I had to use a URL
> (http://localhost/jumpstart/vblanguage/vblanguage.vbproj) and I can open
it,
> but I get the message: "You do not have permission to make changes to this
> document. Do you want to open a read-only copy?"
> I answer Yes, but I still get the error that it is unable to get the
project
> file from the Web Server.
> I can't reproduce exactly what I did before, but at one point I think I
made
> my own Solution file and added everything, but I could not view any of the
> pages in Design view.
> I just want to learn this stuff. I've spent too long just trying to open a
> file and no time reading and learning. It had been very frustrating
(thanks
> for letting me vent).
> Thank you for any help you can provide.
> -Rob
Maybe, but I installed it on a different PC with no problems. So I figured
it was a Microsoft problem, not Paul Sherrif's or Ken Getz's.
"Kevin Spencer" <kevin@.takempis.com> wrote in message
news:OMJfmRD4DHA.3944@.tk2msftngp13.phx.gbl...
> I think you need to contact either Paul Sheriff or Ken Getz for your
answer.
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
> "Rob G" <gumbatman@.hotmail.com> wrote in message
> news:100t3elpo11ir12@.corp.supernews.com...
> > Hi All,
> > I am having a problem that is driving me crazy.
> > I have Windows 2000 Professional, Visual Studio Professional, IIS
> installed
> > and running...
> > I am reading ASP.NET Developer's JumpStart by Paul Sheriff and Ken Getz.
> > I've downloaded the examples and now want to try some of them out.
> > In VS, I go to the File Menu and Select, Open Solution. I go to the
> > directory that the installer put the book's files and select the SLN
> file.I
> > then get the following error:
> > Unable to get the project file from the Web Server. Unable to open
Web
> > Project 'JumpStart/VBLanguage.' The Web 'JumpStart/VBLanguage'
> located
> > on server 'http://localhost/' does not exist.
> > In IIS, their is a virtual directory for JumpStart. I've tried creating
> one
> > for VBLanguage but I still am getting errors.
> > I then tried just opening the Project. I had to use a URL
> > (http://localhost/jumpstart/vblanguage/vblanguage.vbproj) and I can open
> it,
> > but I get the message: "You do not have permission to make changes to
this
> > document. Do you want to open a read-only copy?"
> > I answer Yes, but I still get the error that it is unable to get the
> project
> > file from the Web Server.
> > I can't reproduce exactly what I did before, but at one point I think I
> made
> > my own Solution file and added everything, but I could not view any of
the
> > pages in Design view.
> > I just want to learn this stuff. I've spent too long just trying to open
a
> > file and no time reading and learning. It had been very frustrating
> (thanks
> > for letting me vent).
> > Thank you for any help you can provide.
> > -Rob
Newbie : SMTP Problem
Hi,
I'm a newbie in programming. I have started working on ASP.Net this week. My OS is Windows XP Profesional. IIS 5.1, Visual Studio 2005. I am trying to build a simple user login system from the book "ASP.Net 2.0 Everyday Apps for DUMMIES". I followed every instruction written in the book. Everything is working well apart from sending email to the user while registering or changing password.
Can anyone help me please. Thanx in Advance,
Portion of webconfig file is below:
<system.net>
<mailSettings>
<smtp>
<network host="localhost" port="25" />
</smtp>
</mailSettings>
</system.net>
The error I'm getting is below.
Server Error in '/UserLoginCS' Application.
Mailbox unavailable. The server response was: 5.7.1 Unable to relay forcupidoly@dotnet.itags.org.gmail.com
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.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay forcupidoly@dotnet.itags.org.gmail.com
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:
[SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for cupidoly@dotnet.itags.org.gmail.com] System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +704 System.Net.Mail.SmtpClient.Send(MailMessage message) +2184 System.Web.UI.WebControls.LoginUtil.SendPasswordMail(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +482 System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +639 System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +199 System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +649 System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +157 System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +39 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +178 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3840
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Is your PC a email server?If not,you should set a email server in web.config.Besides,can you paste some codes about how do you send emails?I'm also getting the same error. This error only occurs when email address does not exists.
Error displayed: Server Error in '/' Application. ------------------------ Runtime Error Mailbox unavailable. The server response was: 5.1.1 User unknown 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.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.1.1 User unknown 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: [SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.1.1 User unknown] System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +800307 System.Net.Mail.SmtpClient.Send(MailMessage message) +2004 System.Web.UI.WebControls.LoginUtil.SendPasswordMail(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +341 System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +571 System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +105 System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +453 System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +149 System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +171 System.Web.UI.WebControls.ImageButton.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
Saturday, March 24, 2012
newbie debug asp
been developing some growing .asp programs that do form processing, running
on a different machine, iis5.0,
and would like to be able to run/debug those under my visual studio
environment, so embarrassed
to say don't even know at this point if its possible, so thats the big
question
and then if thats possible, can i simulate the data being passed from the
web page form for testing the asp program??"bbxrider" <bxtrap01@.comcast.net> wrote in message
news:%238wtxmVaFHA.3400@.tk2msftngp13.phx.gbl...
>i have .net2002/visual studio and have only used it so far for vb.net
> been developing some growing .asp programs that do form processing,
> running
> on a different machine, iis5.0,
> and would like to be able to run/debug those under my visual studio
> environment, so embarrassed
> to say don't even know at this point if its possible, so thats the big
> question
> and then if thats possible, can i simulate the data being passed from the
> web page form for testing the asp program??
Hi,
If you are talking about debugging Classic ASP, it's a freakin nightmare.
If I were you, I wouldn't waste my time. Just fill your code full of
Response.Write()s ... that is actually a hell of a lot more effecient.
THANK GOD for .NET!!!
--
Regards,
John MacIntyre
http://www.johnmacintyre.ca
Specializing in; Database, Web-Applications, and Windows Software
thanks for the reply
i have been using the response.write technique, but ran into some kind of
problem, i think because i executed
wscipt.createobject instead of server.createobject and then could not run
any asp! had to reboot, so was trying
to get around that
is it possible then to rewrite the old asp into asp.net and run that on my
win2k/iis5.0 server??
bbx
"John" <Please.Reply@.To.the.group.com> wrote in message
news:uUovjTWaFHA.3808@.TK2MSFTNGP14.phx.gbl...
> "bbxrider" <bxtrap01@.comcast.net> wrote in message
> news:%238wtxmVaFHA.3400@.tk2msftngp13.phx.gbl...
> >i have .net2002/visual studio and have only used it so far for vb.net
> > been developing some growing .asp programs that do form processing,
> > running
> > on a different machine, iis5.0,
> > and would like to be able to run/debug those under my visual studio
> > environment, so embarrassed
> > to say don't even know at this point if its possible, so thats the big
> > question
> > and then if thats possible, can i simulate the data being passed from
the
> > web page form for testing the asp program??
> Hi,
> If you are talking about debugging Classic ASP, it's a freakin nightmare.
> If I were you, I wouldn't waste my time. Just fill your code full of
> Response.Write()s ... that is actually a hell of a lot more effecient.
> THANK GOD for .NET!!!
>
> --
> Regards,
> John MacIntyre
> http://www.johnmacintyre.ca
> Specializing in; Database, Web-Applications, and Windows Software
"bbxrider" <bxtrap01@.comcast.net> wrote in message
news:u2j9zlWaFHA.464@.TK2MSFTNGP15.phx.gbl...
> is it possible then to rewrite the old asp into asp.net and run that on my
> win2k/iis5.0 server??
> bbx
I have asp.net running on a Win2k/IIS5 machine without problems.
thanks again, sounds like my next project
"John" <Please.Reply@.To.the.group.com> wrote in message
news:%23165n2WaFHA.1456@.TK2MSFTNGP15.phx.gbl...
> "bbxrider" <bxtrap01@.comcast.net> wrote in message
> news:u2j9zlWaFHA.464@.TK2MSFTNGP15.phx.gbl...
> > is it possible then to rewrite the old asp into asp.net and run that on
my
> > win2k/iis5.0 server??
> > bbx
>
> I have asp.net running on a Win2k/IIS5 machine without problems.
>
>
>
newbie debug asp
been developing some growing .asp programs that do form processing, running
on a different machine, iis5.0,
and would like to be able to run/debug those under my visual studio
environment, so embarrassed
to say don't even know at this point if its possible, so thats the big
question
and then if thats possible, can i simulate the data being passed from the
web page form for testing the asp program'"bbxrider" <bxtrap01@.comcast.net> wrote in message
news:%238wtxmVaFHA.3400@.tk2msftngp13.phx.gbl...
>i have .net2002/visual studio and have only used it so far for vb.net
> been developing some growing .asp programs that do form processing,
> running
> on a different machine, iis5.0,
> and would like to be able to run/debug those under my visual studio
> environment, so embarrassed
> to say don't even know at this point if its possible, so thats the big
> question
> and then if thats possible, can i simulate the data being passed from the
> web page form for testing the asp program'
>
Hi,
If you are talking about debugging Classic ASP, it's a freakin nightmare.
If I were you, I wouldn't waste my time. Just fill your code full of
Response.Write()s ... that is actually a hell of a lot more effecient.
THANK GOD for .NET!!!
Regards,
John MacIntyre
http://www.johnmacintyre.ca
Specializing in; Database, Web-Applications, and Windows Software
thanks for the reply
i have been using the response.write technique, but ran into some kind of
problem, i think because i executed
wscipt.createobject instead of server.createobject and then could not run
any asp! had to reboot, so was trying
to get around that
is it possible then to rewrite the old asp into asp.net and run that on my
win2k/iis5.0 server'
bbx
"John" <Please.Reply@.To.the.group.com> wrote in message
news:uUovjTWaFHA.3808@.TK2MSFTNGP14.phx.gbl...
> "bbxrider" <bxtrap01@.comcast.net> wrote in message
> news:%238wtxmVaFHA.3400@.tk2msftngp13.phx.gbl...
the
> Hi,
> If you are talking about debugging Classic ASP, it's a freakin nightmare.
> If I were you, I wouldn't waste my time. Just fill your code full of
> Response.Write()s ... that is actually a hell of a lot more effecient.
> THANK GOD for .NET!!!
>
> --
> Regards,
> John MacIntyre
> http://www.johnmacintyre.ca
> Specializing in; Database, Web-Applications, and Windows Software
>
"bbxrider" <bxtrap01@.comcast.net> wrote in message
news:u2j9zlWaFHA.464@.TK2MSFTNGP15.phx.gbl...
> is it possible then to rewrite the old asp into asp.net and run that on my
> win2k/iis5.0 server'
> bbx
I have asp.net running on a Win2k/IIS5 machine without problems.
thanks again, sounds like my next project
"John" <Please.Reply@.To.the.group.com> wrote in message
news:%23165n2WaFHA.1456@.TK2MSFTNGP15.phx.gbl...
> "bbxrider" <bxtrap01@.comcast.net> wrote in message
> news:u2j9zlWaFHA.464@.TK2MSFTNGP15.phx.gbl...
my
>
> I have asp.net running on a Win2k/IIS5 machine without problems.
>
>
>
>
Newbie dynamic color question
MyTable.BackColor = Color.Red
But I can't seem to do a table cell. I have tried this:
MyTable.Rows(1).Cells(1).BackColor = Color.Blue
With this I get the error:
"Specified argument was out of the range of valid values. Parameter name: index "
I have tried inheriting the namespace "System.Drawing"
Can this be done, if so how? If not, how would I do this normally with VB?
ThanksThis means that the row or cell does not exist. Namely, the index of the first row in table is 0, not 1. Same goes for the cells.
So if you have only one row and only one cell, you get an error.
Try
MyTable.Rows(0).Cells(0).BackColor = Color.Blue
I looked back on it and adjusted my code to row 0 and cell 0. I can now get the row to change color, but regardless of what cell I call, it changes the entire row. I tried putting an entry for two cells in the same row, but it just ignores the anything after the first call. Any ideas?
Thursday, March 22, 2012
newbie learns ASP.NET
made me wait long time with Create New Web window
Please tell me what wrong.
System configuration:
Platform: Microsoft Windows XP Pro sp2
web server: IIS 5.0
I also create a virtual directory
Please tell me what wrong
ThanksHi,
1. Does this happen every time you create a new web app?
2. which version of Visual Studio and Asp.Net are you using?
3. Do you get any error during this?
++Vijay R
"Dean L. Howen" wrote:
> I try to create a new web application by Microsoft Visual Studio. But it
> made me wait long time with Create New Web window
> Please tell me what wrong.
> System configuration:
> Platform: Microsoft Windows XP Pro sp2
> web server: IIS 5.0
> I also create a virtual directory
> Please tell me what wrong
> Thanks
>
>I try to create a new web application by Microsoft Visual Studio. But it
>made me wait long time with Create New Web window
> Please tell me what wrong.
I have no idea what is wrong. You're supposed to tell us, and then we tell
you how to fix it.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Dean L. Howen" <coldman@.hotpop.com> wrote in message
news:ubN4OColFHA.1968@.TK2MSFTNGP14.phx.gbl...
>I try to create a new web application by Microsoft Visual Studio. But it
>made me wait long time with Create New Web window
> Please tell me what wrong.
> System configuration:
> Platform: Microsoft Windows XP Pro sp2
> web server: IIS 5.0
> I also create a virtual directory
> Please tell me what wrong
> Thanks
newbie learns ASP.NET
made me wait long time with Create New Web window
Please tell me what wrong.
System configuration:
Platform: Microsoft Windows XP Pro sp2
web server: IIS 5.0
I also create a virtual directory
Please tell me what wrong
ThanksHi,
1. Does this happen every time you create a new web app?
2. which version of Visual Studio and Asp.Net are you using?
3. Do you get any error during this?
++Vijay R
"Dean L. Howen" wrote:
> I try to create a new web application by Microsoft Visual Studio. But it
> made me wait long time with Create New Web window
> Please tell me what wrong.
> System configuration:
> Platform: Microsoft Windows XP Pro sp2
> web server: IIS 5.0
> I also create a virtual directory
> Please tell me what wrong
> Thanks
>
>
>I try to create a new web application by Microsoft Visual Studio. But it
>made me wait long time with Create New Web window
> Please tell me what wrong.
I have no idea what is wrong. You're supposed to tell us, and then we tell
you how to fix it.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Dean L. Howen" <coldman@.hotpop.com> wrote in message
news:ubN4OColFHA.1968@.TK2MSFTNGP14.phx.gbl...
>I try to create a new web application by Microsoft Visual Studio. But it
>made me wait long time with Create New Web window
> Please tell me what wrong.
> System configuration:
> Platform: Microsoft Windows XP Pro sp2
> web server: IIS 5.0
> I also create a virtual directory
> Please tell me what wrong
> Thanks
>
Newbie Microsoft VS.net Code Behind Problem
I am using ASP.net with Code Behind for the first time on Visual Studio. I had some problems and questions.
When we create a Web App Project in VS do i need to copy the resx file too?
Actually i made a page. It is now a .aspx file, a .aspx.vb and a .aspx.resx file. I also made a new class in a VB file. when i built the project i found the dll in the bin folder.
I uploaded the stuff onto the web page (all three, global.asax, web.config) and the dll into the bin folder of my websites root, but it doesnt work. I made some changes in my project and rebuilt it, but the changes werent reflected (i added a Response.Write in the Page_Load).
I copied the vb file to the sites root too but the thing doesnt work. Its working perfectly on my localhost.
I also wanted to know that i added the class in the file by choosing Add Class in the projects menu. So its automatically compiled to a dll right? Another thing is that in localhost the site was working in a folder and not directly in wwwroot (in a folder called even). So when i was to import my custom made namespace it was referenced as Even.MyNameSpace, but normally i compile it to a dll and do it directly.
Another thing is that i tried compiling it to a dll. Visual Studio tools and then VS.net Command prompt, followed by vbc /t:library myVbFile.vb but it couldnt compile. It couldnt find the namespace i imported. It cant even import namespaces like System.Xml etc.
Someone please help. Please tell me if i am not clear as this is a very basic problem.Lots of problems and possible issues here. To start with, you'd have to explain what "didn't work" means. Have you tested a very simple Hello World! ASPX file, with no code behind, to make sure you understand the basics of working with VS and your web host?
Jeff
Well I uploaded a file which on clicking over a button shows the contents of an XML file.
I made a namespace and added a class in it to access and XML file. In my pages code behind i use this class to return the data. (the xml contains values coupled together). The class has many function like getData1, getData2 etc.
The Class for reading the XML throws a user created exception (that i made) if no data existed, else it threw the usual exception. This is caught by the page in which i have called the xml reader class. If its the user exception it simply writes that no data was found else it writes the exceptions text. So initially as i said when i uploaded it gave a message written "The remote server returned an error: (404) Not Found." as the exception's message. I then uploaded all the files i mentioned alongwith the assemblyinfo. But it still didnt work. Then i uploaded a new file which had a "page loaded" string in its page_load, but the changes were not affected. I rebuilt the project in VS and then uploaded the new resx, aspx.vb and aspx files, but to no avail.
I have worked on Dreamweaver and without code behind. Later i tried to compile the VB file but the VS .net command prompt compiler gave me that error. My VS by default creates page with code behind only. Can this be changed? Actually i want to create my own class and compile it to a dll and then make the page inherit from the class from the dll.
I have another question. I had named my project even in VS and then started working in the folder even in the wwwroot. Now i uploaded the whole folder onto the site in a folder placed in the root with the same name as even. Made it an IIS application but still the code doesnt run. It started workng after i uploaded the aspnet_client to the even folder.
Can anyone tell me how i can deploy this to my root? Moreover when i change any file what all files do i need to upload again? Is there a way to prevent VS to automatically creating a page behind as i would like to put all my classes into a dll and then use them as page behind. Moreover when i build the project are the .vb files automatically compiled to dll?
I have one basic question. How do we deploy our VS projects to our web site? I am not able to get any file to work on the website. I have no problems at my own computer and everything is working fine. I am sure a lot of people here can teach me how to deploy VS projects? What all changes etc have to be done?
Im no expert here but if you compile this as a release instead of a Debug build and then create a "Web Setup Project" under the New Projects and then choose Setup and Deployment Projects. Then you can "install" the website to your webserver.
Cleako
I just noticed another thing in your post. If you are going to want your classes in a DLLs separate from the main project then you need to create a class library and place all of your classes that you would like to keep separate in there and then just create instances of those classes within the library in the other project.
Cleako
As you suggested i created a class library. Then i made a file in some Namespace and put in a class. After building it i copied the dll from the bin folder to my sites bin folder. But still i couldnt use the class in my aspx pages. If i compile the same class through command line
vbc /t:library /out:MyClass.dll SomeClass.vb
then it works.
Moreover one of my classes had Imports System.Xml in it. when i build it, it works but when i use the above command line statement in the VS.net Command prompt i get an error saying the file couldnt be found. I dont know what to do and am stuck.
I tried adding the class library to my project, but still cant use it. How do other people generally implement code behind without using VS? I want to create classes in VS but use them in my aspx pages which i make in Dreamweaver.
Friday, March 16, 2012
Newbie Needs Help
I am coming up with an error and don't know how to fix it... Please help me!!!!
Server Error in '/ReadOnly' Application.
------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30180: Keyword does not name a type.
Source Error:
Line 31: <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()> _
Line 32: Public Class Global_asax
Line 33: Inherits ReadOnly.Global
Line 34:
Line 35: Private Shared __initialized As Boolean = false
Source File: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\readonly\cc5ec6d7\7a0c1c27\-u9u0vh1.0.vb Line: 33Please provide code. This will help in determinig the problem...
the code for the page that I have written is
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection
Me.OleDbCommand1 = New System.Data.OleDb.OleDbCommand
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Integrated Security=SSPI;Packet Size=4096;Data Source=018744S;Tag with column col" & _
"lation when possible=False;Initial Catalog=pubs;Use Procedure for Prepare=1;Auto" & _
" Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID" & _
"=018744S;Use Encryption for Data=False"
'
'OleDbCommand1
'
Me.OleDbCommand1.CommandText = "SELECT au_id, au_fname, au_lname, phone FROM authors"
Me.OleDbCommand1.Connection = Me.OleDbConnection1
End Sub
Protected WithEvents OleDbConnection1 As System.Data.OleDb.OleDbConnection
Protected WithEvents OleDbCommand1 As System.Data.OleDb.OleDbCommand
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
OleDbConnection1.Open()
Dim Reader As System.Data.OleDb.OleDbDataReader
Reader = OleDbCommand1.ExecuteReader()
DataGrid1.DataSource = Reader
DataGrid1.DataBind()
Reader.Close()
OleDbConnection1.Close()
End If
End Sub
Private Sub OleDbConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.OleDb.OleDbInfoMessageEventArgs) Handles OleDbConnection1.InfoMessage
End Sub
End Class