Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Saturday, March 31, 2012

Sending/Receiving data from remote app

What is the best / easiest way to send small (<1Kb) data packets to a remote application (known IP address) from an ASP.NET driven web site? The remote app will then send a similar reply packet. It is not a database that is being accessed but a custom application that can be modified to receive and send this data.
Anyone done something similar?how is the remote app usually contacted. Does it send back a httpresponse. or is it some service that returns a stream of characters.
HTTPResponse object if it's replying in http
probably SOCKETS if it's returning data ( like telnet)
I have no experience doing this - but hope that points you in right direction

SendingEMail

I have an ASP.NET web app that I am trying to sens an email from. I use
the code below to send it.
mailMsg := MailMessage.Create;
mailMsg.From := self.Session['SMTPADDRESS'].ToString;
mailMsg.&To := aEMail;
mailMsg.BCC := aAdminEMail;
mailMsg.Subject := 'Your LoginID and Password';
mailMsg.BodyFormat := MailFormat.Text;
mailMsg.Body := 'Your LoginID is '''+aLogin+''' and Password
'''+aPassword+'''';
SmtpMail.SmtpServer := aSMTPServer;
SmtpMail.Send(mailMsg);
My mail server requires password authentication. Where do I assign the
password?
TIAThe following solution is officially unsupported - but it works (you
otherwise need to use CDO or something else to authenticate).
Add these lines to your code before you call SmtpMail.Send()
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthe
nticate",
"1"); //basic authentication
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusern
ame",
myLoginID); //set your username here
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassw
ord",
myPassword); //set your password here
-HTH
"gh" <gh@.at.ne> wrote in message
news:OFCyfZsjFHA.3012@.TK2MSFTNGP12.phx.gbl...
>I have an ASP.NET web app that I am trying to sens an email from. I use
>the code below to send it.
> mailMsg := MailMessage.Create;
> mailMsg.From := self.Session['SMTPADDRESS'].ToString;
> mailMsg.&To := aEMail;
> mailMsg.BCC := aAdminEMail;
> mailMsg.Subject := 'Your LoginID and Password';
> mailMsg.BodyFormat := MailFormat.Text;
> mailMsg.Body := 'Your LoginID is '''+aLogin+''' and Password
> '''+aPassword+'''';
> SmtpMail.SmtpServer := aSMTPServer;
> SmtpMail.Send(mailMsg);
> My mail server requires password authentication. Where do I assign the
> password?
> TIA
Check this out
http://www.systemwebmail.com/faq/3.8.aspx
info@.donotspam dowhileloop.com
http://www.dowhileloop.com -- Website Development
http://publicjoe.dowhileloop.com -- C# & VB.NET Tutorials
"gh" <gh@.at.ne> wrote in message
news:OFCyfZsjFHA.3012@.TK2MSFTNGP12.phx.gbl...
> I have an ASP.NET web app that I am trying to sens an email from. I use
> the code below to send it.
> mailMsg := MailMessage.Create;
> mailMsg.From := self.Session['SMTPADDRESS'].ToString;
> mailMsg.&To := aEMail;
> mailMsg.BCC := aAdminEMail;
> mailMsg.Subject := 'Your LoginID and Password';
> mailMsg.BodyFormat := MailFormat.Text;
> mailMsg.Body := 'Your LoginID is '''+aLogin+''' and Password
> '''+aPassword+'''';
> SmtpMail.SmtpServer := aSMTPServer;
> SmtpMail.Send(mailMsg);
> My mail server requires password authentication. Where do I assign the
> password?
> TIA

Sendkeys not declared?


I just downloaded ASP.Net Web Matrix and I'm really enjoying using it, even though I only know what I am doing about 10% of the time. The one problem I've encountered is that I can't get a VB "SendKeys" statement to work in an ASPX page. I have a really simple script written. Here it is:
Sub Button1_Click(sender As Object, e As EventArgs)
Shell ("notepad", 1)
SendKeys ("%", True)
End Sub
The button code is:
<form id="form1" runat="server">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
</form>
When I run the page, it returns an error that states: "SendKeys statement not declared." Originally, I had no parentheses around "%, True," but ASP.NET demanded it so I put it in. Any help would be greatly appreciated. I am SendKeys-dependent.

Hi,

In .NET SendKey is a class declared in System.Windows.Forms namespace. You can use it as follows:

SendKeys.SendWait("%")

But... It is really not a good idea to open notepad at server from ASP.NET application. Is this what you intend to do?


Thank you so very much for your response. I am continuing to get the same error message, even after adaptation of the command to Sendkeys.Sendwait:

"Compiler Error Message:
BC30451: Name 'SendKeys' is not declared."

I had previously located Sendkeys as an identified namespace within System.Windows.Forms, but I am not sure what to do with that information beyond that. Is there something I need to do to get the page to "talk" with that class or namespace?

As for your caution, I appreciate it. Have read the warnings. The application is going to run only on my PC. Does that minimize the concern?
Again, thank you for your time.


Hi,
You have to reference System.Windows.Forms.dll to use this method.
I think what you want to do is to open notepad from client script and not from server side code. You can use scripting host to do it. In vbscript it will look like this:
Dim WshSHell
set WshShell = CreateObject("WScript.Shell")
WshShell.Run("notepad")
WScript.Sleep(100)
WshShell.AppActivate("Notepad")
WScript.Sleep(100)
WshShell.SendKeys("abc")

sendmail error

Hi there.

I am trying to send an email to a specified valid email address within my asp.net application

I am using the System.web.mail class.

problem is, when it sending the mail using System.Web.Mail.SmtpMail.Send(theEmailObjectHere) it throws me this exception:

"Exception has been thrown by the target of an invocation"

any ideas?

my smtp server does work (using a web smtp provided by a test email address I have made with that service... and they do support smtp!)

exact error message:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --> System.Runtime.InteropServices.COMException (0x8007007F): The specified procedure could not be found. -- End of inner exception stack trace -- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propKey, Object propValue) at System.Web.Mail.LateBoundAccessHelper.SetPropStatic(Object obj, String propName, Object propKey, Object propValue) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at PFTP.createuser.SendEmailRegisterThanks() in c:\inetpub\wwwroot\pftp\createuser.aspx.cs:line 196anyone?
without seeing any code I am going to take a guess - do you have relaying switched on for the virtual smtp server - its on the Access tab under Relay (i think the default is to only allow relaying from certain Ip addresses and there is nothing fiilled in by default).. just pop the IP address of the webserver into the box

sensible way to pass around values

With .NET 1.x, this is what I did. On the destination page
public class ToWebForm : System.Web.UI.Page
{
public const string PARAMETER = "PARAM";
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
Response.Write(paramFromAnotherPage);
}
}
}
And on the source page
Context.Items.Add(ToWebForm.PARAMETER, "value");
Server.Transfer("ToWebForm.aspx");
Basically I am creating an interface (not in a .net sense) on the
destination page so that the source page can simply use the string
constant as the name of the parameter.
.NET 2.0 does not seem to be happy with this. The funny thing is,
sometimes it works, and sometimes it does not even compile, which I
find very frustrating.
Is there any reason why this won't work well with partial classes?
And what is the sensible way to pass values from page to page without
having to copy and past the parameter names all over the web project?..NET 2.0 is "last page aware". Try this:
http://msdn.microsoft.com/msdnmag/i.../ExtremeASPNET/
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)
****************************************
********
Think outside the box!
****************************************
********
"David C" <profnachos@.gmail.com> wrote in message
news:1186434005.231509.3920@.z24g2000prh.googlegroups.com...
> With .NET 1.x, this is what I did. On the destination page
> public class ToWebForm : System.Web.UI.Page
> {
> public const string PARAMETER = "PARAM";
> protected void Page_Load(object sender, System.EventArgs e)
> {
> if (!IsPostBack)
> {
> string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
> Response.Write(paramFromAnotherPage);
> }
> }
> }
> And on the source page
> Context.Items.Add(ToWebForm.PARAMETER, "value");
> Server.Transfer("ToWebForm.aspx");
> Basically I am creating an interface (not in a .net sense) on the
> destination page so that the source page can simply use the string
> constant as the name of the parameter.
> .NET 2.0 does not seem to be happy with this. The funny thing is,
> sometimes it works, and sometimes it does not even compile, which I
> find very frustrating.
> Is there any reason why this won't work well with partial classes?
> And what is the sensible way to pass values from page to page without
> having to copy and past the parameter names all over the web project?
>
On Aug 7, 6:20 am, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@.comcast.netNoSpamM> wrote:
> .NET 2.0 is "last page aware". Try this:http://msdn.microsoft.com/msdnmag/i.../ExtremeASPNET/
>
Thank you very much. I was pleasantly surprised to see that it even
reads the ViewState of the previous page.
Is there anyway to enable this for a gridview? Perhaps a user control or a
hidden button?
Ross
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
message news:%234TxnWP2HHA.3940@.TK2MSFTNGP05.phx.gbl...
> .NET 2.0 is "last page aware". Try this:
> http://msdn.microsoft.com/msdnmag/i.../ExtremeASPNET/
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
> Co-author: Microsoft Expression Web Bible (upcoming)
> ****************************************
********
> Think outside the box!
> ****************************************
********
> "David C" <profnachos@.gmail.com> wrote in message
> news:1186434005.231509.3920@.z24g2000prh.googlegroups.com...
>

sensible way to pass around values

With .NET 1.x, this is what I did. On the destination page

public class ToWebForm : System.Web.UI.Page
{
public const string PARAMETER = "PARAM";
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
Response.Write(paramFromAnotherPage);
}
}
}

And on the source page
Context.Items.Add(ToWebForm.PARAMETER, "value");
Server.Transfer("ToWebForm.aspx");

Basically I am creating an interface (not in a .net sense) on the
destination page so that the source page can simply use the string
constant as the name of the parameter.

..NET 2.0 does not seem to be happy with this. The funny thing is,
sometimes it works, and sometimes it does not even compile, which I
find very frustrating.

Is there any reason why this won't work well with partial classes?

And what is the sensible way to pass values from page to page without
having to copy and past the parameter names all over the web project?..NET 2.0 is "last page aware". Try this:
http://msdn.microsoft.com/msdnmag/i.../ExtremeASPNET/
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"David C" <profnachos@.gmail.comwrote in message
news:1186434005.231509.3920@.z24g2000prh.googlegrou ps.com...

Quote:

Originally Posted by

With .NET 1.x, this is what I did. On the destination page
>
public class ToWebForm : System.Web.UI.Page
{
public const string PARAMETER = "PARAM";
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
Response.Write(paramFromAnotherPage);
}
}
}
>
And on the source page
Context.Items.Add(ToWebForm.PARAMETER, "value");
Server.Transfer("ToWebForm.aspx");
>
Basically I am creating an interface (not in a .net sense) on the
destination page so that the source page can simply use the string
constant as the name of the parameter.
>
.NET 2.0 does not seem to be happy with this. The funny thing is,
sometimes it works, and sometimes it does not even compile, which I
find very frustrating.
>
Is there any reason why this won't work well with partial classes?
>
And what is the sensible way to pass values from page to page without
having to copy and past the parameter names all over the web project?
>


On Aug 7, 6:20 am, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@.comcast.netNoSpamMwrote:

Quote:

Originally Posted by

.NET 2.0 is "last page aware". Try this:http://msdn.microsoft.com/msdnmag/i.../ExtremeASPNET/
>
>


Thank you very much. I was pleasantly surprised to see that it even
reads the ViewState of the previous page.
Is there anyway to enable this for a gridview? Perhaps a user control or a
hidden button?

Ross

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamMwrote in
message news:%234TxnWP2HHA.3940@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

.NET 2.0 is "last page aware". Try this:
http://msdn.microsoft.com/msdnmag/i.../ExtremeASPNET/
>
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)
>
************************************************
Think outside the box!
************************************************
"David C" <profnachos@.gmail.comwrote in message
news:1186434005.231509.3920@.z24g2000prh.googlegrou ps.com...

Quote:

Originally Posted by

>With .NET 1.x, this is what I did. On the destination page
>>
>public class ToWebForm : System.Web.UI.Page
>{
>public const string PARAMETER = "PARAM";
>protected void Page_Load(object sender, System.EventArgs e)
>{
>if (!IsPostBack)
>{
>string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
>Response.Write(paramFromAnotherPage);
>}
>}
>}
>>
>And on the source page
> Context.Items.Add(ToWebForm.PARAMETER, "value");
> Server.Transfer("ToWebForm.aspx");
>>
>Basically I am creating an interface (not in a .net sense) on the
>destination page so that the source page can simply use the string
>constant as the name of the parameter.
>>
>.NET 2.0 does not seem to be happy with this. The funny thing is,
>sometimes it works, and sometimes it does not even compile, which I
>find very frustrating.
>>
>Is there any reason why this won't work well with partial classes?
>>
>And what is the sensible way to pass values from page to page without
>having to copy and past the parameter names all over the web project?
>>


>
>

Separate .config file

I am working on a web app that I want to be able to use a separate
config file on, in addition to the web.config file that's already
working in the application.

If I put the following in the web.config file (VS 2005, Framework 2.0),
I can retrieve the values fine:

<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>

I retrieve the value with this line in the codefile in one of the apps
on the page:

Session("MyExchangeServer") =
WebConfigurationManager.AppSettings("fileInputFolder").ToString

The placement of the above appsettings line is right after the
</system.webin the web.config file, and immediately before the
<system.netline.

Any of those values can be read with no problem if they're in the
web.config file.

I added a new item to my project, app.config.

It looks like this:

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>

</configuration>

It returns this message when I try to load the page.

The format of a configSource file must be an element containing the name
of the section. (C:\Inetpub\wwwroot\test\App.config line 10)

The only thing I have changed from the original app.config file was
where appSettings was already in the file, in the form <appSettings/>.
Where you see the <appSettingsand the 3-4 lines followed by the
</appSettings>, I simply replaced it.

The exact error on the page is:

Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.

Parser Error Message: The format of a configSource file must be an
element containing the name of the section.

Source Error:

Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9: -->
Line 10: <configuration>
Line 11: <appSettings>
Line 12: <add key="fileInputFolder" value="C:\National City
Downloads\test"/>

Source File: C:\Inetpub\wwwroot\test\App.config Line: 10

------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET Version:2.0.50727.210

Any idea what I am doing wrong on this? I'd like to do some more with
this alternate config file, but I'm just trying to get the simple stuff
to work, before I do anything else.

Thanks,

BCBlasting Cap,

The use of the ConfigSource attribute is as follows:

Each section that supports configSource gets specified as
<membership configSource="config\membership.config"/>

In the membership.config (name doesn't matter), you would specify only the
membership section.

<membership defaultProvider="CustomSqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="CustomSqlMembershipProvider"
connectionStringName="<connString>"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
applicationName="<appname>"
requiresUniqueEmail="false"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="5"
passwordFormat="Hashed"
enablePasswordRetrieval="false"
enablePasswordReset="true"/>
</providers>
</membership>

Here is some more info:
http://weblogs.asp.net/fmarguerie/a...tion-files.aspx
Hope this helps,

Steve

"Blasting Cap" <goober@.christian.netwrote in message
news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>
I am working on a web app that I want to be able to use a separate config
file on, in addition to the web.config file that's already working in the
application.
>
If I put the following in the web.config file (VS 2005, Framework 2.0), I
can retrieve the values fine:
>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
>
I retrieve the value with this line in the codefile in one of the apps on
the page:
>
Session("MyExchangeServer") =
WebConfigurationManager.AppSettings("fileInputFolder").ToString
>
The placement of the above appsettings line is right after the
</system.webin the web.config file, and immediately before the
<system.netline.
>
Any of those values can be read with no problem if they're in the
web.config file.
>
I added a new item to my project, app.config.
>
It looks like this:
>
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
>
<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
>
</configuration>
>
>
It returns this message when I try to load the page.
>
The format of a configSource file must be an element containing the name
of the section. (C:\Inetpub\wwwroot\test\App.config line 10)
>
The only thing I have changed from the original app.config file was where
appSettings was already in the file, in the form <appSettings/>. Where you
see the <appSettingsand the 3-4 lines followed by the </appSettings>, I
simply replaced it.
>
The exact error on the page is:
>
Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.
>
Parser Error Message: The format of a configSource file must be an element
containing the name of the section.
>
Source Error:
>
>
Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9: -->
Line 10: <configuration>
Line 11: <appSettings>
Line 12: <add key="fileInputFolder" value="C:\National City
Downloads\test"/>
>
>
Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>
>
------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET Version:2.0.50727.210
>
>
Any idea what I am doing wrong on this? I'd like to do some more with
this alternate config file, but I'm just trying to get the simple stuff to
work, before I do anything else.
>
Thanks,
>
BC


Steve -

thanks for the assistance. With your example and the link, I finally
saw what I was doing....

Thanks!!

BC

PlatinumBay wrote:

Quote:

Originally Posted by

Blasting Cap,
>
The use of the ConfigSource attribute is as follows:
>
Each section that supports configSource gets specified as
<membership configSource="config\membership.config"/>
>
In the membership.config (name doesn't matter), you would specify only the
membership section.
>
<membership defaultProvider="CustomSqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="CustomSqlMembershipProvider"
connectionStringName="<connString>"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
applicationName="<appname>"
requiresUniqueEmail="false"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="5"
passwordFormat="Hashed"
enablePasswordRetrieval="false"
enablePasswordReset="true"/>
</providers>
</membership>
>
Here is some more info:
http://weblogs.asp.net/fmarguerie/a...tion-files.aspx
>
Hope this helps,
>
>
Steve
>
"Blasting Cap" <goober@.christian.netwrote in message
news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>I am working on a web app that I want to be able to use a separate config
>file on, in addition to the web.config file that's already working in the
>application.
>>
>If I put the following in the web.config file (VS 2005, Framework 2.0), I
>can retrieve the values fine:
>>
><appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial
>Catalog=CIC_BankModel;Persist Security Info=True;User
>ID=sa;Password=adminsql"/>
> </appSettings>
>>
>I retrieve the value with this line in the codefile in one of the apps on
>the page:
>>
>Session("MyExchangeServer") =
>WebConfigurationManager.AppSettings("fileInputFolder").ToString
>>
>The placement of the above appsettings line is right after the
></system.webin the web.config file, and immediately before the
><system.netline.
>>
>Any of those values can be read with no problem if they're in the
>web.config file.
>>
>I added a new item to my project, app.config.
>>
>It looks like this:
>>
><?xml version="1.0"?>
><!--
> Note: As an alternative to hand editing this file you can use the
> web admin tool to configure settings for your application. Use
> the Website->Asp.Net Configuration option in Visual Studio.
> A full list of settings and comments can be found in
> machine.config.comments usually located in
> \Windows\Microsoft.Net\Framework\v2.x\Config
>-->
><configuration>
> <appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial
>Catalog=CIC_BankModel;Persist Security Info=True;User
>ID=sa;Password=adminsql"/>
> </appSettings>
> <connectionStrings/>
> <system.web>
> <!--
> Set compilation debug="true" to insert debugging
> symbols into the compiled page. Because this
> affects performance, set this value to true only
> during development.
> -->
> <compilation debug="false" />
> <!--
> The <authenticationsection enables configuration
> of the security authentication mode used by
> ASP.NET to identify an incoming user.
> -->
> <authentication mode="Windows" />
> <!--
> The <customErrorssection enables configuration
> of what to do if/when an unhandled error occurs
> during the execution of a request. Specifically,
> it enables developers to configure html error pages
> to be displayed in place of a error stack trace.
>>
> <customErrors mode="RemoteOnly"
>defaultRedirect="GenericErrorPage.htm">
> <error statusCode="403" redirect="NoAccess.htm" />
> <error statusCode="404" redirect="FileNotFound.htm" />
> </customErrors>
> -->
> </system.web>
>>
></configuration>
>>
>>
>It returns this message when I try to load the page.
>>
>The format of a configSource file must be an element containing the name
>of the section. (C:\Inetpub\wwwroot\test\App.config line 10)
>>
>The only thing I have changed from the original app.config file was where
>appSettings was already in the file, in the form <appSettings/>. Where you
>see the <appSettingsand the 3-4 lines followed by the </appSettings>, I
>simply replaced it.
>>
>The exact error on the page is:
>>
>Configuration Error
>Description: An error occurred during the processing of a configuration
>file required to service this request. Please review the specific error
>details below and modify your configuration file appropriately.
>>
>Parser Error Message: The format of a configSource file must be an element
>containing the name of the section.
>>
>Source Error:
>>
>>
>Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
>Line 9: -->
>Line 10: <configuration>
>Line 11: <appSettings>
>Line 12: <add key="fileInputFolder" value="C:\National City
>Downloads\test"/>
>>
>>
>Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>>
>>
>------------------------
>Version Information: Microsoft .NET Framework Version:2.0.50727.42;
>ASP.NET Version:2.0.50727.210
>>
>>
>Any idea what I am doing wrong on this? I'd like to do some more with
>this alternate config file, but I'm just trying to get the simple stuff to
>work, before I do anything else.
>>
>Thanks,
>>
>BC


>
>


re:
!I want to be able to use a separate config file on, in addition to
!the web.config file that's already working in the application.

To use a separate config file for the appsettings section of web.config, use :

<appSettings configSource="somefile.config"/>

To enable the configuration to be recognized on any change to "somefile.config",
edit machine.config, in the <configSectionssection, and edit <section name="appSettings" ... >,
adding : restartOnExternalChanges="true"

That'd make it :

<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="true"
requirePermission="false" />

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Blasting Cap" <goober@.christian.netwrote in message news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>
I am working on a web app that I want to be able to use a separate config file on, in addition to
the web.config file that's already working in the application.
>
If I put the following in the web.config file (VS 2005, Framework 2.0), I can retrieve the values
fine:
>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial Catalog=CIC_BankModel;Persist
Security Info=True;User ID=sa;Password=adminsql"/>
</appSettings>
>
I retrieve the value with this line in the codefile in one of the apps on the page:
>
Session("MyExchangeServer") = WebConfigurationManager.AppSettings("fileInputFolder").ToString
>
The placement of the above appsettings line is right after the </system.webin the web.config
file, and immediately before the <system.netline.
>
Any of those values can be read with no problem if they're in the web.config file.
>
I added a new item to my project, app.config.
>
It looks like this:
>
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial Catalog=CIC_BankModel;Persist
Security Info=True;User ID=sa;Password=adminsql"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
>
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
>
</configuration>
>
>
It returns this message when I try to load the page.
>
The format of a configSource file must be an element containing the name of the section.
(C:\Inetpub\wwwroot\test\App.config line 10)
>
The only thing I have changed from the original app.config file was where appSettings was already
in the file, in the form <appSettings/>. Where you see the <appSettingsand the 3-4 lines
followed by the </appSettings>, I simply replaced it.
>
The exact error on the page is:
>
Configuration Error
Description: An error occurred during the processing of a configuration file required to service
this request. Please review the specific error details below and modify your configuration file
appropriately.
>
Parser Error Message: The format of a configSource file must be an element containing the name of
the section.
>
Source Error:
>
>
Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9: -->
Line 10: <configuration>
Line 11: <appSettings>
Line 12: <add key="fileInputFolder" value="C:\National City Downloads\test"/>
>
>
Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>
>
------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
>
>
Any idea what I am doing wrong on this? I'd like to do some more with this alternate config file,
but I'm just trying to get the simple stuff to work, before I do anything else.
>
Thanks,
>
BC

Separate .config file

I am working on a web app that I want to be able to use a separate
config file on, in addition to the web.config file that's already
working in the application.
If I put the following in the web.config file (VS 2005, Framework 2.0),
I can retrieve the values fine:
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
I retrieve the value with this line in the codefile in one of the apps
on the page:
Session("MyExchangeServer") =
WebConfigurationManager.AppSettings("fileInputFolder").ToString
The placement of the above appsettings line is right after the
</system.web> in the web.config file, and immediately before the
<system.net> line.
Any of those values can be read with no problem if they're in the
web.config file.
I added a new item to my project, app.config.
It looks like this:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
It returns this message when I try to load the page.
The format of a configSource file must be an element containing the name
of the section. (C:\Inetpub\wwwroot\test\App.config line 10)
The only thing I have changed from the original app.config file was
where appSettings was already in the file, in the form <appSettings/>.
Where you see the <appSettings> and the 3-4 lines followed by the
</appSettings>, I simply replaced it.
The exact error on the page is:
Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.
Parser Error Message: The format of a configSource file must be an
element containing the name of the section.
Source Error:
Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9: -->
Line 10: <configuration>
Line 11: <appSettings>
Line 12: <add key="fileInputFolder" value="C:\National City
Downloads\test"/>
Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
----
--
Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET Version:2.0.50727.210
Any idea what I am doing wrong on this? I'd like to do some more with
this alternate config file, but I'm just trying to get the simple stuff
to work, before I do anything else.
Thanks,
BCBlasting Cap,
The use of the ConfigSource attribute is as follows:
Each section that supports configSource gets specified as
<membership configSource="config\membership.config"/>
In the membership.config (name doesn't matter), you would specify only the
membership section.
<membership defaultProvider="CustomSqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="CustomSqlMembershipProvider"
connectionStringName="<connString>"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
applicationName="<appname>"
requiresUniqueEmail="false"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="5"
passwordFormat="Hashed"
enablePasswordRetrieval="false"
enablePasswordReset="true"/>
</providers>
</membership>
Here is some more info:
http://weblogs.asp.net/fmarguerie/a...tion-files.aspx
Hope this helps,
Steve
"Blasting Cap" <goober@.christian.net> wrote in message
news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...
> I am working on a web app that I want to be able to use a separate config
> file on, in addition to the web.config file that's already working in the
> application.
> If I put the following in the web.config file (VS 2005, Framework 2.0), I
> can retrieve the values fine:
> <appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial
> Catalog=CIC_BankModel;Persist Security Info=True;User
> ID=sa;Password=adminsql"/>
> </appSettings>
> I retrieve the value with this line in the codefile in one of the apps on
> the page:
> Session("MyExchangeServer") =
> WebConfigurationManager.AppSettings("fileInputFolder").ToString
> The placement of the above appsettings line is right after the
> </system.web> in the web.config file, and immediately before the
> <system.net> line.
> Any of those values can be read with no problem if they're in the
> web.config file.
> I added a new item to my project, app.config.
> It looks like this:
> <?xml version="1.0"?>
> <!--
> Note: As an alternative to hand editing this file you can use the
> web admin tool to configure settings for your application. Use
> the Website->Asp.Net Configuration option in Visual Studio.
> A full list of settings and comments can be found in
> machine.config.comments usually located in
> \Windows\Microsoft.Net\Framework\v2.x\Config
> -->
> <configuration>
> <appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial
> Catalog=CIC_BankModel;Persist Security Info=True;User
> ID=sa;Password=adminsql"/>
> </appSettings>
> <connectionStrings/>
> <system.web>
> <!--
> Set compilation debug="true" to insert debugging
> symbols into the compiled page. Because this
> affects performance, set this value to true only
> during development.
> -->
> <compilation debug="false" />
> <!--
> The <authentication> section enables configuration
> of the security authentication mode used by
> ASP.NET to identify an incoming user.
> -->
> <authentication mode="Windows" />
> <!--
> The <customErrors> section enables configuration
> of what to do if/when an unhandled error occurs
> during the execution of a request. Specifically,
> it enables developers to configure html error pages
> to be displayed in place of a error stack trace.
> <customErrors mode="RemoteOnly"
> defaultRedirect="GenericErrorPage.htm">
> <error statusCode="403" redirect="NoAccess.htm" />
> <error statusCode="404" redirect="FileNotFound.htm" />
> </customErrors>
> -->
> </system.web>
> </configuration>
>
> It returns this message when I try to load the page.
> The format of a configSource file must be an element containing the name
> of the section. (C:\Inetpub\wwwroot\test\App.config line 10)
> The only thing I have changed from the original app.config file was where
> appSettings was already in the file, in the form <appSettings/>. Where you
> see the <appSettings> and the 3-4 lines followed by the </appSettings>, I
> simply replaced it.
> The exact error on the page is:
> Configuration Error
> Description: An error occurred during the processing of a configuration
> file required to service this request. Please review the specific error
> details below and modify your configuration file appropriately.
> Parser Error Message: The format of a configSource file must be an element
> containing the name of the section.
> Source Error:
>
> Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
> Line 9: -->
> Line 10: <configuration>
> Line 11: <appSettings>
> Line 12: <add key="fileInputFolder" value="C:\National City
> Downloads\test"/>
>
> Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>
> ----
--
> Version Information: Microsoft .NET Framework Version:2.0.50727.42;
> ASP.NET Version:2.0.50727.210
>
> Any idea what I am doing wrong on this? I'd like to do some more with
> this alternate config file, but I'm just trying to get the simple stuff to
> work, before I do anything else.
> Thanks,
> BC
Steve -
thanks for the assistance. With your example and the link, I finally
saw what I was doing....
Thanks!!
BC
PlatinumBay wrote:
> Blasting Cap,
> The use of the ConfigSource attribute is as follows:
> Each section that supports configSource gets specified as
> <membership configSource="config\membership.config"/>
> In the membership.config (name doesn't matter), you would specify only the
> membership section.
> <membership defaultProvider="CustomSqlMembershipProvider"
> userIsOnlineTimeWindow="15">
> <providers>
> <clear/>
> <add name="CustomSqlMembershipProvider"
> connectionStringName="<connString>"
> type="System.Web.Security.SqlMembershipProvider, System.Web,
> Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
> applicationName="<appname>"
> requiresUniqueEmail="false"
> minRequiredPasswordLength="7"
> minRequiredNonalphanumericCharacters="1"
> maxInvalidPasswordAttempts="5"
> passwordAttemptWindow="5"
> passwordFormat="Hashed"
> enablePasswordRetrieval="false"
> enablePasswordReset="true"/>
> </providers>
> </membership>
> Here is some more info:
> http://weblogs.asp.net/fmarguerie/a...tion-files.aspx
> Hope this helps,
>
> Steve
> "Blasting Cap" <goober@.christian.net> wrote in message
> news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...
>
re:
!> I want to be able to use a separate config file on, in addition to
!> the web.config file that's already working in the application.
To use a separate config file for the appsettings section of web.config, use
:
<appSettings configSource="somefile.config"/>
To enable the configuration to be recognized on any change to "somefile.conf
ig",
edit machine.config, in the <configSections> section, and edit <section name
="appSettings" ... >,
adding : restartOnExternalChanges="true"
That'd make it :
<section name="appSettings" type="System.Configuration.AppSettingsSection, S
ystem.Configuration,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOn
ExternalChanges="true"
requirePermission="false" />
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Blasting Cap" <goober@.christian.net> wrote in message news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.p
hx.gbl...
> I am working on a web app that I want to be able to use a separate config
file on, in addition to
> the web.config file that's already working in the application.
> If I put the following in the web.config file (VS 2005, Framework 2.0), I
can retrieve the values
> fine:
> <appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial Catalog
=CIC_BankModel;Persist
> Security Info=True;User ID=sa;Password=adminsql"/>
> </appSettings>
> I retrieve the value with this line in the codefile in one of the apps on
the page:
> Session("MyExchangeServer") = WebConfigurationManager.AppSettings("fileInp
utFolder").ToString
> The placement of the above appsettings line is right after the </system.we
b> in the web.config
> file, and immediately before the <system.net> line.
> Any of those values can be read with no problem if they're in the web.conf
ig file.
> I added a new item to my project, app.config.
> It looks like this:
> <?xml version="1.0"?>
> <!--
> Note: As an alternative to hand editing this file you can use the
> web admin tool to configure settings for your application. Use
> the Website->Asp.Net Configuration option in Visual Studio.
> A full list of settings and comments can be found in
> machine.config.comments usually located in
> \Windows\Microsoft.Net\Framework\v2.x\Config
> -->
> <configuration>
> <appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial Catalog
=CIC_BankModel;Persist
> Security Info=True;User ID=sa;Password=adminsql"/>
> </appSettings>
> <connectionStrings/>
> <system.web>
> <!--
> Set compilation debug="true" to insert debugging
> symbols into the compiled page. Because this
> affects performance, set this value to true only
> during development.
> -->
> <compilation debug="false" />
> <!--
> The <authentication> section enables configuration
> of the security authentication mode used by
> ASP.NET to identify an incoming user.
> -->
> <authentication mode="Windows" />
> <!--
> The <customErrors> section enables configuration
> of what to do if/when an unhandled error occurs
> during the execution of a request. Specifically,
> it enables developers to configure html error pages
> to be displayed in place of a error stack trace.
> <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.
htm">
> <error statusCode="403" redirect="NoAccess.htm" />
> <error statusCode="404" redirect="FileNotFound.htm" />
> </customErrors>
> -->
> </system.web>
> </configuration>
>
> It returns this message when I try to load the page.
> The format of a configSource file must be an element containing the name o
f the section.
> (C:\Inetpub\wwwroot\test\App.config line 10)
> The only thing I have changed from the original app.config file was where
appSettings was already
> in the file, in the form <appSettings/>. Where you see the <appSettings> a
nd the 3-4 lines
> followed by the </appSettings>, I simply replaced it.
> The exact error on the page is:
> Configuration Error
> Description: An error occurred during the processing of a configuration fi
le required to service
> this request. Please review the specific error details below and modify yo
ur configuration file
> appropriately.
> Parser Error Message: The format of a configSource file must be an element
containing the name of
> the section.
> Source Error:
>
> Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
> Line 9: -->
> Line 10: <configuration>
> Line 11: <appSettings>
> Line 12: <add key="fileInputFolder" value="C:\National City Downloads\
test"/>
>
> Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>
> ----
--
> Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NE
T Version:2.0.50727.210
>
> Any idea what I am doing wrong on this? I'd like to do some more with thi
s alternate config file,
> but I'm just trying to get the simple stuff to work, before I do anything
else.
> Thanks,
> BC

Separate Project DLLs

Dear Group
Apologies for this simple question. Would be grateful if you share your
opinion on this.
I've written a web application, compiling all classes into one project
DLL. Now I wonder if there are performance / resource advantages if I
compile some classes into separate DLLs and reference them instead. Any
articles, information on this? Advantages, Divantages? Will it slow
down the application if it has to reference a DLL?
Thanks very much for your help & efforts!
MartinPerformance isn't a factor...Divantage? You have 2+ dlls floating around
which might make it harder to maintain (assuming you are shipping a product,
which you likely aren't). Advantages? Better organization, reuse, less
bloat...
There's really no reason not to...but you shouldn't just do it for the sake
of it...hopefully there's some reasoning behind why they don't belong
together...
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
<theintrepidfox@.hotmail.com> wrote in message
news:1112238300.593113.237330@.f14g2000cwb.googlegroups.com...
> Dear Group
> Apologies for this simple question. Would be grateful if you share your
> opinion on this.
> I've written a web application, compiling all classes into one project
> DLL. Now I wonder if there are performance / resource advantages if I
> compile some classes into separate DLLs and reference them instead. Any
> articles, information on this? Advantages, Divantages? Will it slow
> down the application if it has to reference a DLL?
> Thanks very much for your help & efforts!
> Martin
>
It is not a matter of performance. It is a matter of your system design. For
example, if you organize your application in presentation, business and data
access layers, you might have all forms in one project, business classes in
another project and data access classes in another project. 3 projects, 3
dlls.
Eliyahu
<theintrepidfox@.hotmail.com> wrote in message
news:1112238300.593113.237330@.f14g2000cwb.googlegroups.com...
> Dear Group
> Apologies for this simple question. Would be grateful if you share your
> opinion on this.
> I've written a web application, compiling all classes into one project
> DLL. Now I wonder if there are performance / resource advantages if I
> compile some classes into separate DLLs and reference them instead. Any
> articles, information on this? Advantages, Divantages? Will it slow
> down the application if it has to reference a DLL?
> Thanks very much for your help & efforts!
> Martin
>

Separate Project DLLs

Dear Group

Apologies for this simple question. Would be grateful if you share your
opinion on this.

I've written a web application, compiling all classes into one project
DLL. Now I wonder if there are performance / resource advantages if I
compile some classes into separate DLLs and reference them instead. Any
articles, information on this? Advantages, Disadvantages? Will it slow
down the application if it has to reference a DLL?

Thanks very much for your help & efforts!

MartinPerformance isn't a factor...Disadvantage? You have 2+ dlls floating around
which might make it harder to maintain (assuming you are shipping a product,
which you likely aren't). Advantages? Better organization, reuse, less
bloat...

There's really no reason not to...but you shouldn't just do it for the sake
of it...hopefully there's some reasoning behind why they don't belong
together...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)

<theintrepidfox@.hotmail.com> wrote in message
news:1112238300.593113.237330@.f14g2000cwb.googlegr oups.com...
> Dear Group
> Apologies for this simple question. Would be grateful if you share your
> opinion on this.
> I've written a web application, compiling all classes into one project
> DLL. Now I wonder if there are performance / resource advantages if I
> compile some classes into separate DLLs and reference them instead. Any
> articles, information on this? Advantages, Disadvantages? Will it slow
> down the application if it has to reference a DLL?
> Thanks very much for your help & efforts!
> Martin
It is not a matter of performance. It is a matter of your system design. For
example, if you organize your application in presentation, business and data
access layers, you might have all forms in one project, business classes in
another project and data access classes in another project. 3 projects, 3
dlls.

Eliyahu

<theintrepidfox@.hotmail.com> wrote in message
news:1112238300.593113.237330@.f14g2000cwb.googlegr oups.com...
> Dear Group
> Apologies for this simple question. Would be grateful if you share your
> opinion on this.
> I've written a web application, compiling all classes into one project
> DLL. Now I wonder if there are performance / resource advantages if I
> compile some classes into separate DLLs and reference them instead. Any
> articles, information on this? Advantages, Disadvantages? Will it slow
> down the application if it has to reference a DLL?
> Thanks very much for your help & efforts!
> Martin

Thursday, March 29, 2012

Separate webfolder for each developer in single web project

Hi, please read this before
http://groups.google.ru/group/micro...-JaaxaeIKyXy0Eg
I need to organize the same structure in my solution. This means to
have 1 Web Application Project or Web Site Project. But when developers
get solution from VSS and start them they should have their own
WebFolder to be opened. That means dev1 should have web project in
remotehost\dev1webfolder, dev in remotehost\dev2webfolder.
And i don't want developers to change project file in vss on their own
computers to reach this.

Please. helpIf you are remoting, set up a source repository (SourceSafe, CVS,
Subversion, Team System). Each developer checks out to a different spot on
the machine. Everyone remotes in and has code in a different directory.
NOTE: Only one person can debug at a time if you are on one machine, ulnless
you set up independent app pools (or use file based webs if using Visual
Studio 2005).

To set up independent app pools, you go into IIS and create the app pools.
After having each developer pull code to a specific location, you set up the
applications as web applications and set their pool.

Open IIS Manager
Create pools
Have developers get code to a directory
Set each developers directory in IIS by creating new virtual directories
Right click each application directory in IIS Mgr and go to properties
Under home directory, set the application pool for this application

Once again, you CAN go to file based webs, which require no setup.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
<alexey.yakovlev@.gmail.comwrote in message
news:1158064382.308774.159710@.i42g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

Hi, please read this before
http://groups.google.ru/group/micro...-JaaxaeIKyXy0Eg
>
I need to organize the same structure in my solution. This means to
have 1 Web Application Project or Web Site Project. But when developers
get solution from VSS and start them they should have their own
WebFolder to be opened. That means dev1 should have web project in
remotehost\dev1webfolder, dev in remotehost\dev2webfolder.
And i don't want developers to change project file in vss on their own
computers to reach this.
>
Please. help
>

Separate VB app to talk back to a Web Service

Customer sends XML data to our Web Service. Web Service does some
data transformation and puts the data into a special format that
another application uses. That data is in a file.
This other application continuously polls a folder for these data
files and processes them. It eventually creates a PDF out of the
data with a unique file name.
Web service needs to know when this other application is done
processing this data so I can send a URL of the created PDF back to
customer.
What would be the best way to do this? I don't want to sit there and
poll a folder for the output file, as we may have up to 40,000
requests / day.look at windows workflow or sqlserver broker services.
-- bruce (sqlwork.com)
"Larry Bud" wrote:

> Customer sends XML data to our Web Service. Web Service does some
> data transformation and puts the data into a special format that
> another application uses. That data is in a file.
> This other application continuously polls a folder for these data
> files and processes them. It eventually creates a PDF out of the
> data with a unique file name.
> Web service needs to know when this other application is done
> processing this data so I can send a URL of the created PDF back to
> customer.
> What would be the best way to do this? I don't want to sit there and
> poll a folder for the output file, as we may have up to 40,000
> requests / day.
>
In addition to Bruce's suggestion - what I have done in the past is have a
method that allows the client to check a DB value against each created file
using the number they are given on submission. For me it was word files
converted to PDF and a succesful creation triggered a DB update and then
stored the output URL - cleaning up after a 24 hour period. Because its
only a small request with a single return value it was cheap for the client
to check the webservice for a success flag and then get the URL. This
didn't massively impact throughput and could be hosted on a different app
server entirely.
Regards
John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"bruce barker" <brucebarker@.discussions.microsoft.com> wrote in message
news:7BFFAD45-86AA-48B5-AFB1-42DB21056491@.microsoft.com...
> look at windows workflow or sqlserver broker services.
> -- bruce (sqlwork.com)
>
> "Larry Bud" wrote:
>
On Feb 11, 4:37=A0pm, "John Timney \(MVP\)"
<xyz_j...@.timney.eclipse.co.uk> wrote:
> In addition to Bruce's suggestion - what I have done in the past is have a=[/color
]
> method that allows the client to check a DB value against each created fil=[/color
]
e
> using the number they are given on submission. =A0For me it was word files=[/color
]
> converted to PDF and a succesful creation triggered a DB update and then
> stored the output URL - cleaning up after a 24 hour period. =A0Because its=[/color
]
> only a small request with a single return value it was cheap for the clien=[/color
]
t
> to check the webservice for a success flag and then get the URL. =A0This
> didn't massively impact throughput and could be hosted on a different app
> server entirely.
>
Wouldn't you have to keep hitting the database to see if the file was
created successfully?
Yes, but it doesn't have to be the same database, or even the same database
server!
Regards
John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Larry Bud" <larrybud2002@.yahoo.com> wrote in message
news:e2449b23-38af-4876-88c5-df0f10f77278@.s8g2000prg.googlegroups.com...
On Feb 11, 4:37 pm, "John Timney \(MVP\)"
<xyz_j...@.timney.eclipse.co.uk> wrote:
> In addition to Bruce's suggestion - what I have done in the past is have a
> method that allows the client to check a DB value against each created
> file
> using the number they are given on submission. For me it was word files
> converted to PDF and a succesful creation triggered a DB update and then
> stored the output URL - cleaning up after a 24 hour period. Because its
> only a small request with a single return value it was cheap for the
> client
> to check the webservice for a success flag and then get the URL. This
> didn't massively impact throughput and could be hosted on a different app
> server entirely.
>
Wouldn't you have to keep hitting the database to see if the file was
created successfully?

Seperate Content from Code

After nearing completion of my first full .Net web application I am left with a page consisitng of around 600 lines of code, approximately split half and half between VB script and HTML page content.

Can anyone point me in the right direction of the best way to encapsulate the VB code into its own seperate file and then rerefence this from the form in the HTML page?

Hi,

you could place the code into separate aspx.vb file into its own class deriving form System.Web.UI.Page. Then putting the aspx to inherit from this code-behind class (with Inherits directive) would work.

Say you have files

page1.aspx (important ones are CodeFile and Inherits attributes)

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="page1.aspx.vb" Inherits="page1" %>

...

page1.aspx.vb

Partial Class page1

Inherits System.Web.UI.Page

End Class

When you could put code into aspx.vb file into the class.

More information :http://www.asp.net/QuickStart/aspnet/doc/pages/codebehind.aspx

Of course if have code & logic which is such that it's common to more than one form, you might want to consider having a separate component (class library or in App_Code) where you could centralize logic that is needed in multiple places.


Thanks joteke, I think I'm slowly getting there.

So the .aspx file inherits the class that you create in the aspx.vb file ?

Then within that class you simply insert all the code that was previously in the <script> section at the top of the .aspx file?

What does the'AutoEventWireup' attribute do?


Also, do i need to import the namespaces in the aspx file or the aspx.vb file ?

duncanhall:

So the .aspx file inherits the class that you create in the aspx.vb file ?

Yes. Basically with partial classes in ASP.NET 2.0 (when using CodeFile attribute) a second partial class is created. This class contains control declarations for controls residing on aspx (removes the need for you to declare them on aspx.vb as you had to do with ASP.NEt v1.x).

These two partial classes are merged when compilation occurs and are used as base class for class which is created when the actual aspx is parsed and compiled (yes, basically the aspx itself)

duncanhall:



Then within that class you simply insert all the code that was previously in the <script> section at the top of the .aspx file?

Yes, note that the code-behind class is now equally part of your page.

duncanhall:


What does the'AutoEventWireup' attribute do?

It indicates whether Page's event are autowired. If enabled, it means that you have a method which matches Page_[EventName] or [ControlID]_[EventName] name so that method would automatically be assigned as event handler for the correspondng event of P?ager or the Control. Normally these event methods need to be wired explicitly.

See:ASP.NET Web Server Control Event Model


If code is in code-behind, then you import in code-behind.
Thanks a lot joteke, everything seems to make sense now, and my first app is pretty much finished!

Seperate Auth for single page

Can you specify a different authentication method ('none') for a single
page? I have the web.config designed for 'Forms' auth, but I have one page
that I want outside the auth method, without putting it into a seperate
folder with it's own web.config.

Thanks

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.comYou can specify some pages to require login, and others to not require login
via your web.config file by using the <location> tag.

Here is an example with sample code that you can download and play with.
http://www.dotnetbips.com/displayarticle.aspx?id=117

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%23GKNgVP4DHA.1700@.TK2MSFTNGP11.phx.gbl...
> Can you specify a different authentication method ('none') for a single
> page? I have the web.config designed for 'Forms' auth, but I have one page
> that I want outside the auth method, without putting it into a seperate
> folder with it's own web.config.
> Thanks
> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> www.Darkfalz.com
Yes - see the <location> element of web.config.

example:

<location path="Logon.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location
HTH,

--
Scott
http://www.OdeToCode.com

On Thu, 22 Jan 2004 08:40:56 -0600, "Curt_C [MVP]"
<software_AT_darkfalz.com> wrote:

>Can you specify a different authentication method ('none') for a single
>page? I have the web.config designed for 'Forms' auth, but I have one page
>that I want outside the auth method, without putting it into a seperate
>folder with it's own web.config.
>Thanks

Seperate data content from UI

I have data in XML. I need to be able to present the data in a web page
which may be charts, tables and other such like controls. I need to be
able to modify the appearance of this page simply and quickly (a
requirement being a two day turnaround). Ultimately I need a page where
the user can control the layout themselves, but this is not an immediate
requirement. Also, it may be that they need to control not just the
appearance but functionality and behaviour(which may be a seperate
issue?). Now I'm new to this kind of thing, since I dont usually work
on the GUI side of things but this particular project is all about the
GUI. So what I'm asking for is some ideas not solutions :-) I've
thought it may be possible to do this sort of thing with cascading
stylesheets?? But that wouldn't allow me to change the behaviour of
controls on the form (though it certainly would be a start no?). Also
what about XUL? (or is that really going in the wrong direction) Is
there anything I can do specifically ASP-orientated that would make my
task easier, or am I really posing an HTML question? Perhaps it's even
a case of writing XSL to transform the XML so that it outputs HTML, and
the behaviour of the controls could be dependent on the XML they are given?

Ideas greatly appreciated :-)There are a two issues here. You need the ability to change
"appearence" but also you may need the ability to change
"functionality".

Design-wise, I would go with something similar to MVC. That way you
have a pretty good separation.

Implementation-wise I would go with ASP.NET 2 with Skins and
Personalization (as long as they are ready, I don't see the reason to
create my own) as long as you develop using ASP.NET 2.

If you don't, CSS is a good candidate for styling/markup separation but
quite difficult for changing behavior. There you should rely on sth
like different views on the MVC model.

XUL is supported only by FireFox right now, so I don't know if you want
to go to this direction.

Check Personalization and Skins in ASP.NET 2. I think you 'll find the
answers to these questions.

Regards,
Tasos
* Tasos Vogiatzoglou wrote:
> There are a two issues here. You need the ability to change
> "appearence" but also you may need the ability to change
> "functionality".
> Design-wise, I would go with something similar to MVC. That way you
> have a pretty good separation.
> Implementation-wise I would go with ASP.NET 2 with Skins and
> Personalization (as long as they are ready, I don't see the reason to
> create my own) as long as you develop using ASP.NET 2.
> If you don't, CSS is a good candidate for styling/markup separation but
> quite difficult for changing behavior. There you should rely on sth
> like different views on the MVC model.
> XUL is supported only by FireFox right now, so I don't know if you want
> to go to this direction.
> Check Personalization and Skins in ASP.NET 2. I think you 'll find the
> answers to these questions.
> Regards,
> Tasos

Many thanks for putting me in the right direction, I shall go find
Google :-)

Seperate data content from UI

I have data in XML. I need to be able to present the data in a web page
which may be charts, tables and other such like controls. I need to be
able to modify the appearance of this page simply and quickly (a
requirement being a two day turnaround). Ultimately I need a page where
the user can control the layout themselves, but this is not an immediate
requirement. Also, it may be that they need to control not just the
appearance but functionality and behaviour(which may be a seperate
issue?). Now I'm new to this kind of thing, since I dont usually work
on the GUI side of things but this particular project is all about the
GUI. So what I'm asking for is some ideas not solutions :-) I've
thought it may be possible to do this sort of thing with cascading
stylesheets' But that wouldn't allow me to change the behaviour of
controls on the form (though it certainly would be a start no?). Also
what about XUL? (or is that really going in the wrong direction) Is
there anything I can do specifically ASP-orientated that would make my
task easier, or am I really posing an HTML question? Perhaps it's even
a case of writing XSL to transform the XML so that it outputs HTML, and
the behaviour of the controls could be dependent on the XML they are given?
Ideas greatly appreciated :-)There are a two issues here. You need the ability to change
"appearence" but also you may need the ability to change
"functionality".
Design-wise, I would go with something similar to MVC. That way you
have a pretty good separation.
Implementation-wise I would go with ASP.NET 2 with Skins and
Personalization (as long as they are ready, I don't see the reason to
create my own) as long as you develop using ASP.NET 2.
If you don't, CSS is a good candidate for styling/markup separation but
quite difficult for changing behavior. There you should rely on sth
like different views on the MVC model.
XUL is supported only by FireFox right now, so I don't know if you want
to go to this direction.
Check Personalization and Skins in ASP.NET 2. I think you 'll find the
answers to these questions.
Regards,
Tasos
* Tasos Vogiatzoglou wrote:
> There are a two issues here. You need the ability to change
> "appearence" but also you may need the ability to change
> "functionality".
> Design-wise, I would go with something similar to MVC. That way you
> have a pretty good separation.
> Implementation-wise I would go with ASP.NET 2 with Skins and
> Personalization (as long as they are ready, I don't see the reason to
> create my own) as long as you develop using ASP.NET 2.
> If you don't, CSS is a good candidate for styling/markup separation but
> quite difficult for changing behavior. There you should rely on sth
> like different views on the MVC model.
> XUL is supported only by FireFox right now, so I don't know if you want
> to go to this direction.
> Check Personalization and Skins in ASP.NET 2. I think you 'll find the
> answers to these questions.
> Regards,
> Tasos
>
Many thanks for putting me in the right direction, I shall go find
Google :-)

Sequence of events

Hi all,

I've got an aspx page with a Web user control and (among other things) a
submit button. When the form is submitted, the same page is to be served
back up, but with some items changed, mainly a panel visible that had not
been and a setting in the user control. The problem I'm having is figuring
out how to manipulate the flagging values as the submit's handler doesn't
fire until the page and controls' load methods. I'm a bit fuzzy on the
firing order of methods between objects, but am I better off moving such
code to the PreRender methods?

TIA,

JohnYour button click event handler should contain the code to flip the
visibility of the panel. The Page_Load code should only contain code that
should execute no matter what.

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
Yes, moving the code to PreRender is a good idea. It is not always possible,
especially if what has been clicked affects databinding, but, if it is not a
case, go for it. You can't change event sequence.

Eliyahu

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
Hi John,

I keep the following bookmark handy, when I need to work more closely with
the execution lifecycle:

http://msdn.microsoft.com/library/d...onLifecycle.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
> figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
Thanks, all! One problem down, 3.2 million to go <g>.

"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>

Sequence of events

Hi all,
I've got an aspx page with a Web user control and (among other things) a
submit button. When the form is submitted, the same page is to be served
back up, but with some items changed, mainly a panel visible that had not
been and a setting in the user control. The problem I'm having is figuring
out how to manipulate the flagging values as the submit's handler doesn't
fire until the page and controls' load methods. I'm a bit fuzzy on the
firing order of methods between objects, but am I better off moving such
code to the PreRender methods?
TIA,
JohnYour button click event handler should contain the code to flip the
visibility of the panel. The Page_Load code should only contain code that
should execute no matter what.
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>
Yes, moving the code to PreRender is a good idea. It is not always possible,
especially if what has been clicked affects databinding, but, if it is not a
case, go for it. You can't change event sequence.
Eliyahu
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>
Hi John,
I keep the following bookmark handy, when I need to work more closely with
the execution lifecycle:
http://msdn.microsoft.com/library/d...onLifecycle.asp
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
> figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>
Thanks, all! One problem down, 3.2 million to go <g>.
"John Spiegel" <jspiegel@.YETANOTHERSPAMHATERc-comld.com> wrote in message
news:OgWT8hZ8EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi all,
> I've got an aspx page with a Web user control and (among other things) a
> submit button. When the form is submitted, the same page is to be served
> back up, but with some items changed, mainly a panel visible that had not
> been and a setting in the user control. The problem I'm having is
figuring
> out how to manipulate the flagging values as the submit's handler doesn't
> fire until the page and controls' load methods. I'm a bit fuzzy on the
> firing order of methods between objects, but am I better off moving such
> code to the PreRender methods?
> TIA,
> John
>
>

Monday, March 26, 2012

Sequential numbers without a database?

Hi all,

I'd building an app that posts to a web service. One of the things
that is required in the soap header is a sequential number appended to
a ref, i.e. "IGI1001", "IGI1002", etc.

Obviously the first part of the reference ("IGI") stays the same, but
I need an incrementing number generated. Now, I was thinking of doing
this via a SQL database, but it would be an awful waste as there would
only be one table and one stored procedure in it. Then I was thinking
of putting it in an application variable: it would be read from a file
at the application start, incremented through the life of the
application, then written back to the file at application end. I
quickly discounted that in case the new number didn't get written back
to the file for whatever reason.

Incidentally, the web service expects the caller to provide the
incrementing alpha-numeric reference, so it won't be done at the web
service.

Any thoughts?

Kind regards,

Mike KingscottHallo Mike
"Mike Kingscott" <mike@.kingscott.f9.co.uk> schrieb im Newsbeitrag
news:7d9b584d.0407010225.3365dc16@.posting.google.c om...
> Hi all,
> I'd building an app that posts to a web service. One of the things
> that is required in the soap header is a sequential number appended to
> a ref, i.e. "IGI1001", "IGI1002", etc.
> Obviously the first part of the reference ("IGI") stays the same, but
> I need an incrementing number generated. Now, I was thinking of doing
> this via a SQL database, but it would be an awful waste as there would
> only be one table and one stored procedure in it. Then I was thinking
> of putting it in an application variable: it would be read from a file
> at the application start, incremented through the life of the
> application, then written back to the file at application end. I
> quickly discounted that in case the new number didn't get written back
> to the file for whatever reason.
> Incidentally, the web service expects the caller to provide the
> incrementing alpha-numeric reference, so it won't be done at the web
> service.
> Any thoughts?
> Kind regards,
> Mike Kingscott

I think, wether it is a waste, to use a sql database. its the safest way to
ensure there is always an incremented number.

regards benni
Any chance you could use a timestamp, or a GUID in the headers to make
them unique? Or does it absolutely have to be a sequential number?

Perhaps you could use a combination of incremented number and a
TimeStamp. The TimeStamp could be the time at which the application
started, say with DateTime.Now.Ticks. The sequential ID could then be
a static field that you increment with the Interlocked.Increment
method.

Possible?

--
Scott
http://www.OdeToCode.com

On 1 Jul 2004 03:25:58 -0700, mike@.kingscott.f9.co.uk (Mike Kingscott)
wrote:

>Hi all,
>I'd building an app that posts to a web service. One of the things
>that is required in the soap header is a sequential number appended to
>a ref, i.e. "IGI1001", "IGI1002", etc.
>Obviously the first part of the reference ("IGI") stays the same, but
>I need an incrementing number generated. Now, I was thinking of doing
>this via a SQL database, but it would be an awful waste as there would
>only be one table and one stored procedure in it. Then I was thinking
>of putting it in an application variable: it would be read from a file
>at the application start, incremented through the life of the
>application, then written back to the file at application end. I
>quickly discounted that in case the new number didn't get written back
>to the file for whatever reason.
>Incidentally, the web service expects the caller to provide the
>incrementing alpha-numeric reference, so it won't be done at the web
>service.
>Any thoughts?
>Kind regards,
>Mike Kingscott