I am looking for an tried-and-tested approach to share .ASPX webpages across websites. E.g. I have a generic error page which I would like to share between x.com and y.com sites.
I got loads of website, that share one of two baseclasses. I need the two baseclasses to be able to share part of the same code. I dont want to have to duplicate the shared code per baseclass.
so.. I got a page.aspx that inherits the baseclass and that inhertis 'sub' baseclass that inherits the web.ui.page class. So far so good :-)
In my baseclass I got a Public (at the top of the class not in any method- not sure of the proper term) Varable that is constructed from a structure in the BO class.
it Public PageDetails AS CoreDomainSetupBO.GetStartUpDetails = {database method}
I need the pagedetails to be available in the sub baseclass but it cant be defined there as the page details value is defined differently in the different base classes.
I hope that makes sense, I need to sub base class to be able to use a property that is defined at baseclass level.
I have built a website and now the customer wants to split it between three different domains. What is the best way to do this? This is what I have so far.
c:/website1/ points to www.website1.com c:/website1/vd1/ points to www.website2.com c:/website1/vd2/ points to www.website3.com
The webhost I'm working with has done it the following way, but now I'm getting a bunch of errors that seems like it's not seeing the App_code folder. Do I need to make a lot of changes? How does this affect the location references?
I see on the bottom of blog pages a sharing buttons (Twitter and Facebook), where if clicked the link behind (which is normally the blog page url) the fshare button takes the clicker to the blog site facebook page respectively.
How does one do this in asp.net 2 , does one one use the <%# %> in the url part of these share buttons, are there any examples of how this is done?
I'm missing a the code browser when I create pages that have the code not placed in a seperate file. For pages with .asp.vb files I get the browser correctly.
I think it's called a code browser but just in case it's not I mean the dropdown that shows Page Events, Buttons and other controls that can be selected along with their events.
How do I turn on those dropdowns for pages with code behind that uses <script> tags in the actual .aspx page?
Included (Showing page events just under the tab):
i have to insert a "Google Analytics Tracking Code" java script to all pages in my website, before </body> tag.There is no master pages so i could not use them. Is there any way to insert a code from global.asax into all pages? If i use application_endrequest then it goes to the very last line which is after </html> tag.
I'm working on a master page, I right click and add a content page, However now I am missing the code behind. So if I make a default2.aspx there is no default2.cs. I can't figure out what I did, It was functioning perfectly before.
I have implimented Forms Authentication on my web project.
I need to set some of the form pages so that the user cannot open them without being logged in to the web site. How do I code the additional pages so that it requires them to login?
I need to display c#, vb.net or any source code on a web page. The source code that will be displayed should indented, colored as we see in any IDE. I am not sure how would i achieve this. Is there any in-built control available in asp.net that i can use to display the code or can someone tell me how can i achieve this.
I've been trying for 3 hours to figure this out... Basically I'm trying to incorporate this script into my personal website which is built using .NET Master Pages...
The link to the demo is here [URL]
I copied this guys code and built locally on my machine to test. Works find UNTIL you convert the HTML to ASPX and add the <form runat="server"></form> tags. Is there a work around for this or a method that works better? I'm trying to understand how to properly insert such code into a .NET website for both now and future purposes.
It seems liken no matter what logic I put in my code, this runs every single time, and because of this, unless I am viewing this particular content page, I get an error.
I have a default.aspx page, another asp page needs to be a copy of it. lets call that Revised.aspx
I've copied over all the front end Default.aspx code, building all the way. It was fine. When I copied the methods from the codebehind to the Revised.aspx.cs page, it gives errors saying the var names etc do not exist in the current context - even though they do?
Now, I'm working on a project where I don't really understand how can I do things without multiple inheritance, without duplicating code.
Here's the situation. There is a website with a home page and other pages inheriting from a masterpage (the home page does not inherit from). Both the page and the masterpage are performing some stuff: custom login, statistics, loading of users settings for customization, etc. For the moment, the solution is crappy, since the source code for those tasks is just copied twice.
The home page class inherits from Page. The masterpage, on the other hand, inherits from Masterpage. Logically, it would be great to inherit from a common class too, but it's multiple inheritance, so it's impossible.
So what to do instead?
I thought about several ways, but dislike them:
Create a standalone class which will be called from the page/masterpage class. So for example instead of writing bool isDisplayingTips = this.CurrentUser.IsDisplayingTips, I would write bool isDisplayingTips = this.SharedObjects.CurrentUser.IsDisplayingTips. I don't like it, since it's longer to write. Create a "real", empty, common masterpage, and inherit both the home page and the masterpage from it. Not only it will require to write more code to access masterpage parameters, but it will also slow the things down, requiring an additional masterpage on each request.
I'm just starting out learning ASP.NET. From what I understand, ASP.NET differs from old school ASP in that the logic code for a page exists in as separate file rather then being embedded in the ASP page. So when a user requests a page like ShoppingCart.aspx the server reads the directive at the top ...
This tells the server what file and what class in the file is associated with the page. The code behind class also has member variables that correspond to each control on the page, and provide a way for code in the code behind file to manipulate the controls.
First, do I understand this correctly?
Second, could a site be setup with two separate ASPX pages with identically named controls, which both had a directive pointing to the same file and class? Would you even want to do this? Both pages could have the same functionality but a different layout. I was thinking this could be a way to create separate "desktop" and "mobile" versions of a page with out duplicating content in the code behind files.
I guess ultimately what I'm wondering, is if there a way to define an abstract page? Say create an abstract page definition that says a page must have controls "cart_list", "total_lbl", but then be able to have multiple pages that inherit from this abstract page?
Is there a way to check for errors in unopened *.ASPX pages. For example, if you change the name of a function Visual Studio will catch the error on the page and list it in the "Error List" only if the page is opened and being validated?
How do i find out about the following without running the page through the webserver or opening the page to be validated in VS?
<script runat="server"> Public Sub MyFunciton() Undefined_FUNCTION() End Sub </script>
I am taking over for a website in ASP.Net (VB.Net) where the live site is compiled code. So there's no code behind pages. So other than the ASP.Net pages, it's just DLL files in the bin folder.It's also at an ISP where I have no control over the server to remote in.
I have gotten from the client, what I believe to be the latest and greatest code. So there's code behind pages and also a vbproj file. It seems to be have done in an early version of Visual Studio.Thinking maybe 2003.I only have Microsoft Visual Web Developer 2010 (I've been using) and VS2005.So I made a very basic change just to test the waters and built the website, which made a brand new DLL for the site in bin. Also new pdb and xml document. It works fine on dev.I uploaded just this DLL to live. However on live, when I get to the part where I'm submitting a form.I get a very non descript 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.] wwwPittsburghKids.CMP_MembershipNew.cmdSave_Click(Object sender, EventArgs e) +6630 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +114 [code]....
I can't see the line number of the error + am I compiling the DLL wrong?I trying to figure out how to do this without breaking the live site. Is there a way to tell what version of .Net it's compiled in.
how to add pages in the Form Authentication Sample Code. I am required to add a registration form in this Custom Security Solution. It lets me add the .cs files but when I add .aspx file, it gives errors in building. let me know what architecture have they followed? Why they have .resx files?
I need my child pages to be able to set the values of certain properties of the Master page before loading. In other words, how my application builds the Master page for the client depends upon what properties are set by the child pages on the back-end. For example:
public partial class mstrPage : System.Web.UI.MasterPage { public int Rows { get; set; } public int Cols { get; set; } protected void Page_Load(object sender, EventArgs e) { /* Build a .NET two-dimensional-array of divs that is <Rows> tall and <Cols> wide. */ } }
In this example, the child page needs to set the values of <Rows> and <Cols> before Page_Load() is invoked for the Master. This is fairly simple to accomplish with inheritance in OOP, but ASP.NET web pages do not "inherit" their master pages in the code-behind. In the given example, what would the code-behind look like for the ASP.NET child page that sets these properties?
14 days ago all emails were being delivered without any error, but now none of the email is delivered neither from local site nor from hosted site.I did not change any single letter of code in web.config and in pages.
Web config file is as follows. <appSettings> <add key="MailFromAddress" value="<user name>@gmail.com"/> <add key="MailToAddress" value="<user name>@gmail.com"/>[code]....
myMessage.From = New MailAddress(AppConfiguration.MailFromAddress, AppConfiguration.SenderName) myMessage.To.Add(New MailAddress(AppConfiguration.MailToAddress, AppConfiguration.ReceiverName))
Dim mySmtpClient As New SmtpClient() Try mySmtpClient.EnableSsl = True[code]....
On debugging it always fires the catch block. Earlier I never had such problem with emails but for last few days none of the email is being delivered.Is it my system problem? Is it any port no. issue? My local site and remote site are not delivering any message. what could be the reason and how I make it functioning as before.