Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Saturday, March 31, 2012

Strange "expected ;" error

I am getting an error and I can't seem to figure out why. The error is on line 32.

Compiler Error Message: CS1002: ; expected

Line 30: strScriptName=Request.ServerVariables("SCRIPT_NAME");
Line 31: strFolder="/buildlauncher/";
Line 32: If (strScriptName.IndexOf(strFolder)=-1)
Line 33: {
Line 34: strbuildlauncher="class='selected'";

The language I am using is C# and I don't seem to understand what a ; would be doing in an if statement. What I am trying to do is determine if the folder specified in the strFolder variable is in the server variable SCRIPT_NAME.There are some syntax problems here:

If (strScriptName.IndexOf(strFolder)=-1)

should probably be

if(strScriptName.IndexOf(strFolder) == -1)

Note the case sensitivity and the equality operator.

Wednesday, March 28, 2012

Strange compilation error

Hi,

From time to time, I receive following error message when trying to access
my website.
When the error occurs, I have to recompile my dll until the error disappears
(this without changing anything in my code).
Where does this error come from ? What can I do to solve the problem ?
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0030: Cannot convert type
'System.Web.HttpApplication' to 'ASP.Global_asax'

Source Error:

Line 438: protected ASP.Global_asax ApplicationInstance {
Line 439: get {
Line 440: return
((ASP.Global_asax)(this.Context.ApplicationInstanc e));
Line 441: }
Line 442: }

Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Tempo rary ASP.NET
Files\emagic.net.website\1a713704\55d0ac6a\5rffbzu b.0.cs Line: 440Hi,

As you can figure out its a prpblem with dynamic compilation of pages
(and asax). do you write any code in your application asax file? if so
can you post it or at least tell what you are doing ? usually those
errors ate outcome of code being write in asax code behind.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Strange compilation error

Hi,
From time to time, I receive following error message when trying to access
my website.
When the error occurs, I have to recompile my dll until the error disappears
(this without changing anything in my code).
Where does this error come from ? What can I do to solve the problem ?
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: CS0030: Cannot convert type
'System.Web.HttpApplication' to 'ASP.Global_asax'
Source Error:
Line 438: protected ASP.Global_asax ApplicationInstance {
Line 439: get {
Line 440: return
((ASP.Global_asax)(this.Context.ApplicationInstance));
Line 441: }
Line 442: }
Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\emagic.net.website\1a713704\55d0ac6a\5rffbzub.0.cs Line: 440Hi,
As you can figure out its a prpblem with dynamic compilation of pages
(and asax). do you write any code in your application asax file? if so
can you post it or at least tell what you are doing ? usually those
errors ate outcome of code being write in asax code behind.
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Strange compiler behavior after CS0006 error

yesterday i started getting this strange error when i try to run my asp.net
project:

Compiler Error Message: CS0006: Metadata file
'c:\winnt\microsoft.net\framework\v1.1.4322\tempor ary asp.net
files\spsweb\0e3514bf\cb1844e7\assembly\dl2\3b163f
16\00452d31_84e5c301\infragistics.webui.ultrawebgr id.v3.dll' could not be
found

I could get around it with either restarting vs.net or force a rebuild of
the entire solution.
I know that the file in the error is a third party control and have already
contacted the creators about it. But i think this is only a sympton of a
bigger problem.
I found a new strange problem today: i created a listbox and a button
(standard asp.net controls) on the form but there events do not fire
properly. The selectedindex change event on the listbox goes through the
page_load (as normal) but doesn't go through the code in the event itself
and the click event ont the button doesn't do anything (put breakpoint
everywhere no code is executed). Both have autopostback, enabled viewstate
and all other properties set right.
It seems that i can do all the normal things in code that already existed
before the strange compile error started but any new code behind new events
is simply ignored.

Can anyone shed any light on these wierd problems ?

Kris Vanherk
Ferranti Computer SystemsHi,

I'm having similar problems, for the last couple of days I have problems
each time I debug a ASP.NET application, it says that cannot access a temp
dll it creates in C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Tempora ry
ASP.NET Files\web_application_name

I have to restart the service to keep it running again.

I'm trying still to figure out what is going on.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Kris Vanherck" <KVanHe@.ferranti.be> wrote in message
news:%23BsTeb5JEHA.3412@.TK2MSFTNGP09.phx.gbl...
> yesterday i started getting this strange error when i try to run my
asp.net
> project:
> Compiler Error Message: CS0006: Metadata file
> 'c:\winnt\microsoft.net\framework\v1.1.4322\tempor ary asp.net
> files\spsweb\0e3514bf\cb1844e7\assembly\dl2\3b163f
> 16\00452d31_84e5c301\infragistics.webui.ultrawebgr id.v3.dll' could not be
> found
>
> I could get around it with either restarting vs.net or force a rebuild of
> the entire solution.
> I know that the file in the error is a third party control and have
already
> contacted the creators about it. But i think this is only a sympton of a
> bigger problem.
> I found a new strange problem today: i created a listbox and a button
> (standard asp.net controls) on the form but there events do not fire
> properly. The selectedindex change event on the listbox goes through the
> page_load (as normal) but doesn't go through the code in the event itself
> and the click event ont the button doesn't do anything (put breakpoint
> everywhere no code is executed). Both have autopostback, enabled viewstate
> and all other properties set right.
> It seems that i can do all the normal things in code that already existed
> before the strange compile error started but any new code behind new
events
> is simply ignored.
> Can anyone shed any light on these wierd problems ?
> Kris Vanherk
> Ferranti Computer Systems
I have come across some post linking the last batch of updates to weirds
behaviors,
I have changed nothing on my system outsite them and now the IIS or the
ASP.NET framework is behaving different,
I was debugging an application and used Response.Redirect() to a page that
was not existent, before it would give me an error in the browser ( not
found resource or something like that) , now I get a messagebox on the IDE
saying that a "A first chance exception of type
'System.IO.FileNotFoundException' occurred in system.web.dll" , next another
popup appear reading : "There is no source code available for the current
location." and gives me the opportunity to show the dissassembled coded

Any one knows something about this?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Strange compiler behavior after CS0006 error

yesterday i started getting this strange error when i try to run my asp.net
project:
Compiler Error Message: CS0006: Metadata file
'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net
files\spsweb\0e3514bf\cb1844e7\assembly\
dl2\3b163f
16\00452d31_84e5c301\infragistics.webui.ultrawebgrid.v3.dll' could not be
found
I could get around it with either restarting vs.net or force a rebuild of
the entire solution.
I know that the file in the error is a third party control and have already
contacted the creators about it. But i think this is only a sympton of a
bigger problem.
I found a new strange problem today: i created a listbox and a button
(standard asp.net controls) on the form but there events do not fire
properly. The selectedindex change event on the listbox goes through the
page_load (as normal) but doesn't go through the code in the event itself
and the click event ont the button doesn't do anything (put breakpoint
everywhere no code is executed). Both have autopostback, enabled viewstate
and all other properties set right.
It seems that i can do all the normal things in code that already existed
before the strange compile error started but any new code behind new events
is simply ignored.
Can anyone shed any light on these wierd problems ?
Kris Vanherk
Ferranti Computer SystemsHi,
I'm having similar problems, for the last couple of days I have problems
each time I debug a ASP.NET application, it says that cannot access a temp
dll it creates in C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET Files\web_application_name
I have to restart the service to keep it running again.
I'm trying still to figure out what is going on.
Cheers,
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Kris Vanherck" <KVanHe@.ferranti.be> wrote in message
news:%23BsTeb5JEHA.3412@.TK2MSFTNGP09.phx.gbl...
> yesterday i started getting this strange error when i try to run my
asp.net
> project:
> Compiler Error Message: CS0006: Metadata file
> 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net
> files\spsweb\0e3514bf\cb1844e7\assembly\
dl2\3b163f
> 16\00452d31_84e5c301\infragistics.webui.ultrawebgrid.v3.dll' could not be
> found
>
> I could get around it with either restarting vs.net or force a rebuild of
> the entire solution.
> I know that the file in the error is a third party control and have
already
> contacted the creators about it. But i think this is only a sympton of a
> bigger problem.
> I found a new strange problem today: i created a listbox and a button
> (standard asp.net controls) on the form but there events do not fire
> properly. The selectedindex change event on the listbox goes through the
> page_load (as normal) but doesn't go through the code in the event itself
> and the click event ont the button doesn't do anything (put breakpoint
> everywhere no code is executed). Both have autopostback, enabled viewstate
> and all other properties set right.
> It seems that i can do all the normal things in code that already existed
> before the strange compile error started but any new code behind new
events
> is simply ignored.
> Can anyone shed any light on these wierd problems ?
> Kris Vanherk
> Ferranti Computer Systems
>

Monday, March 26, 2012

Strange Error !

Strange Error !!!

Help please.. i was testing my application today and i get this error message for the first time
and i don't know what i did wrong.. or what causing it.. i didn't get this error before
only today..the error is :

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

please help me..it is driving me crazy.. because i tried to track it down using breakpoints but it didn't work

Regards,

Ninawell what are you doing? Are you adding controls dynamically? If so where do you do this?
It means you changed something about the code and then did a SUBMIT (clicked on something) from the pre-change version of the page.

You should always revisit your page fresh. If you believe you are visiting them fresh, then add to the Page_Load:
Response.Expires = -1;
Thanks Lord_Rat, but can you explain more please? what is page fresh?
It means that it's possible that the page you are loading is coming from your cache, rather than from the server. If it's from the cache, then the viewstates will not match those 'expected' by the server, and you get that error.

By adding his code, you are telling the browser not to cache the page, so that everytime you visit that page, it is loaded afresh from the server, thereby eliminating the problem.
thank you mendhak you are always near when i need you.. :)

for more info about this thread, check this:
http://www.codecomments.com/archive315-2005-2-398077.html

Strange Error !

Strange Error !!!

Help please.. i was testing my application today and i get this error message for the first time
and i don't know what i did wrong.. or what causing it.. i didn't get this error before
only today..the error is :

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

please help me..it is driving me crazy.. because i tried to track it down using breakpoints but it didn't work

Regards,

Nina

Hey you might have build your application, but still the browser is getting reference from the previous builds. Just try a refresh of your page or a new browser window

HTH


i did what you asked me and still getting the error

Saturday, March 24, 2012

Strange error message at client

Hello!

I would like to do database change on a web page created with ASP.NET.

As soon as I click on Update in a datagrid web control, I get following
error message:

Unable to find script library
'/asp_client/system_web/1_0_3705_288/WebUIValidation.js'. Try placing this
file manually, or reinstall by running 'aspnet_regiis -c'.

I must say, that this file does exist in the path shown in the error
message. Insofar the error message is very strange.

Which are the reasons for the error? Could it be, that some ASP.NET sites
use a SmartNavigation or are the security settings at client to high?

Regards,
RobertTry running aspnet_regiis on the web site you are using. This is a
client-side error that is triggered by the file not being there, at least
from the client's perspective, so that's a good place to start.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Robert Wehofer" <thalion77@.graffiti.net> wrote in message
news:c4%tb.112229$W7.62099@.news.chello.at...
> Hello!
> I would like to do database change on a web page created with ASP.NET.
> As soon as I click on Update in a datagrid web control, I get following
> error message:
> Unable to find script library
> '/asp_client/system_web/1_0_3705_288/WebUIValidation.js'. Try placing this
> file manually, or reinstall by running 'aspnet_regiis -c'.
> I must say, that this file does exist in the path shown in the error
> message. Insofar the error message is very strange.
> Which are the reasons for the error? Could it be, that some ASP.NET sites
> use a SmartNavigation or are the security settings at client to high?
> Regards,
> Robert

Strange error message

I'm getting the following error from a standard datagrid on an .aspx page, can anyone tell me what causes this?

System.Web.UI.WebControls.DataGridColumnCollection must have items of type 'System.Web.UI.WebControls.DataGridColumn'. 'table' is of type 'System.Web.UI.HtmlControls.HtmlTable'.Can you show how you have declared the DataGrid?
You are propably trying to add a HTML-Table to the Columns-collection of your DataGrid.

If you posted the code where this error occurs we will surely be able to help you out. You can usually find the line-number in the code-behind file from where the error originated. That is if you have compiled in Debug-mode.
I've not included the columns as there's a lot of code, let me know if you need them.


<ASP:DataGrid id="MyDataGrid" runat="server"
Width="500" BorderColor="black"
ShowFooter="false" CellPadding=3 CellSpacing="0"
HeaderStyle-CssClass="scroller" HeaderStyle-BackColor="#000033"
ItemStyle-CssClass="columnText" EditItemStyle-CssClass="columnText"
OnEditCommand="MyDataGrid_Edit" OnCancelCommand="MyDataGrid_Cancel"
OnUpdateCommand="MyDataGrid_Update" OnDeleteCommand="MyDataGrid_Delete"
DataKeyField="SupplierID" AutoGenerateColumns="false"
AllowPaging="true" PageSize="10" OnPageIndexChanged="MyDataGrid_Page"
PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right"
PagerStyle-Visible="true" >

Put it all, columns are crucial here.
Here is the full code:


<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
//The line above is the one causing the error
<tr>
<td>
<form id="form1" runat="server">
<table width="590" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="500" BorderColor="black"
ShowFooter="false" CellPadding=3 CellSpacing="0"
HeaderStyle-CssClass="scroller" HeaderStyle-BackColor="#000033"
ItemStyle-CssClass="columnText" EditItemStyle-CssClass="columnText"
OnEditCommand="MyDataGrid_Edit" OnCancelCommand="MyDataGrid_Cancel"
OnUpdateCommand="MyDataGrid_Update" OnDeleteCommand="MyDataGrid_Delete"
DataKeyField="SupplierID" AutoGenerateColumns="false"
AllowPaging="true" PageSize="10" OnPageIndexChanged="MyDataGrid_Page"
PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right"
PagerStyle-Visible="true" >
<Columns>
<asp:EditCommandColumn HeaderText="Edit" EditText="Edit" CancelText="Cancel" UpdateText="Update" ItemStyle-Wrap="false"/>
<asp:BoundColumn HeaderText="ID" SortExpression="SupplierID" ReadOnly="True" DataField="SupplierID" ItemStyle-Wrap="false"/
<asp:TemplateColumn HeaderText="Suppliers" SortExpression="txt_Supplier">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Supplier") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Supplier" Width="150" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Supplier") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Contact" SortExpression="txt_Contact">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Contact") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Contact" Width="100" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Contact") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Address1" SortExpression="txt_Address1">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Address1") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Address1" Width="150" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Address1") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Address2" SortExpression="txt_Address2">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Address2") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Address2" Width="150" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Address2") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Town" SortExpression="txt_Town">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Town") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Town" Width="100" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Town") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="City" SortExpression="txt_City">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_City") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_City" Width="100" Text='<%# DataBinder.Eval(Container.DataItem, "txt_City") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Post Code" SortExpression="txt_PostCode">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_PostCode") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_PostCode" Width="50" Text='<%# DataBinder.Eval(Container.DataItem, "txt_PostCode") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Phone" SortExpression="txt_Phone">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Phone") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Phone" Width="50" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Phone") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Fax" SortExpression="txt_Fax">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Fax") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Fax" Width="50" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Fax") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Mobile" SortExpression="txt_Mobile">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Mobile") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Mobile" Width="50" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Mobile") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Email" SortExpression="txt_Email">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Email") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_Email" Width="100" Text='<%# DataBinder.Eval(Container.DataItem, "txt_Email") %>' CssClass="columnText" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:TemplateColumn HeaderText="Notes" SortExpression="txt_SupplierNotes">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "txt_SupplierNotes") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="add_txt_SupplierNotes" Width="250" Text='<%# DataBinder.Eval(Container.DataItem, "txt_SupplierNotes") %>'
CssClass="columnText" TextMode="MultiLine" Rows="6"/>
</EditItemTemplate>
</asp:TemplateColumn
</ASP:DataGrid>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>

Are you sure there isn't anything before that line that could cause it? More nested grids or tables?
Nothing that I can see. This is the only datagrid on the page and the other tables on the page are completely seperate from this one.

It's pretty weird as I've created a few other similar pages without any problems.

Thursday, March 22, 2012

Strange issue with system.web.mail

Hello,

I have a strange issue when sending e-mails using system.web.mail. For an unknown reason every 990 character is a space in my message body. Not a big issue? Well, bigger then you can think. If the 990 character is in the middle of a HTML-tag, the message body is constructed wrong.

I tested this with the script you can find below. Try it yourself to see the result. I use Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300. My provider doesn't have another version available for me.

<%@dotnet.itags.org. Import Namespace = "System.Text" %>
<%@dotnet.itags.org. Import Namespace = "System.Web.Mail" %>
<script runat="server">
Sub SubmitEmail(sender As Object, e As EventArgs)
Dim sMsg as String
sMsg ="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"
sMsg+="123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-"

doEmail("name.to@dotnet.itags.org.yourhost.com", "name.from@dotnet.itags.org.yourhost.com", sMsg, "Test e-mail")
End Sub

Function doEmail(sTo as String, sFrom as String, sMsg as String, sSubject as String) 'Email component
Dim objEmail as New MailMessage
objEmail.To=sTo 'TO
objEmail.FROM=sFrom 'From

objEmail.SUBJECT=sSubject 'Subject
objEmail.BODY=sMsg 'Link Message body
objEmail.BodyFormat = MailFormat.HTML 'MailFormat.Text = RichText & MailFormat.HTML = HTML
SmtpMail.SmtpServer ="localhost" 'SMTP server
SmtpMail.Send(objEmail) 'Send message
End Function
</script>
<form runat="server">
<asp:Button id="Submit" text="Submit e-mail" OnClick="SubmitEmail" runat="server" />
</form>

Is this a known issue? What is the solution? I prefer not buying a e-mail component?

Thanks for your suggestions.

I don't know the answer - but have you tried stringbuilder. I have read about problems using string ( mostly performance related ) and that stringbuilder is the best choice ( for most string building situations)

This issue is solved. I found the solution here:

http://www.systemwebmail.com/faq/4.4.5.aspx

Usually you have a line in the body that is too long. The email rfc's state that a line should not contain more than 1000 characters. Try inserting a CrLf (vbCrLf for VB.NET or "\r\n" for C#) in your message body to break up long lines.

Tuesday, March 13, 2012

Strange problem

I have a class method which takes integer as parameter...when i call the
method as shown below i get this error message: Specified cast is not valid
<td><%# bs.getPriority((int)DataBinder.Eval(Container.DataItem,
"Priority"))%></td>
When i print the DataItem "Priority" it shows an integer value, but for some
reason the method does not like value.. if i call this method like ->
bs.getPriortiy(3); it works fine.
In the database i have a field called "Priority" int type...
The method works fine when i call it in DataItemBound method..
any idea?Hi,
Try using
int.Parse(DataBinder.Eval(Container.DataItem, "Priority"))
DataBinder.Eval returns a string value type. (int) is used to
implicitly cast values to integers. Strings must be explicitly cast
using the Parse method.
Hope this helps.
Tod Birdsall, MCP
http://tod1d.blogspot.com
Tod thank you so much :) it worked..
still why one of them works not the other as shown below:
<TD><%# bs.getCampusName((int)DataBinder.Eval(Container.DataItem,
"CampusID"))%></TD>
<td><%# bs.getCampusName((int.Parse(DataBinder.Eval(Container.DataItem,
"Priority")))%></td>
both CampusID and Priority is same type of value..
Many Thanks again.
"Tod Birdsall" wrote:

> Hi,
> Try using
> int.Parse(DataBinder.Eval(Container.DataItem, "Priority"))
> DataBinder.Eval returns a string value type. (int) is used to
> implicitly cast values to integers. Strings must be explicitly cast
> using the Parse method.
> Hope this helps.
> Tod Birdsall, MCP
> http://tod1d.blogspot.com
>
Sorry that did not solve the problem... :( i am getting this error message
now:
The best overloaded method match for 'int.Parse(string)' has some invalid
arguments
"Tod Birdsall" wrote:

> Hi,
> Try using
> int.Parse(DataBinder.Eval(Container.DataItem, "Priority"))
> DataBinder.Eval returns a string value type. (int) is used to
> implicitly cast values to integers. Strings must be explicitly cast
> using the Parse method.
> Hope this helps.
> Tod Birdsall, MCP
> http://tod1d.blogspot.com
>
Acutally, DataBinder.Eval returns an object unless you pass a third
parameter, a format specifier, i.e.
DataBinder.Eval(Container.DataItem, "Priority", "{0:d}")
Otherwise you get an object reference back, in which case you could
use Convert.ToInt32
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 9 Nov 2004 07:38:03 -0800, "huzz"
<huzz@.discussions.microsoft.com> wrote:
>Sorry that did not solve the problem... :( i am getting this error message
>now:
>The best overloaded method match for 'int.Parse(string)' has some invalid
>arguments
>"Tod Birdsall" wrote:
>
Hi,
Scott is correct. Sorry for the mis-information.
I tried to reproduce your error message. I created a function in the
code behind like so:
protected string GetRemainderInEscrow(decimal approvedAmount, object
paidAmount)
I then called the method from the aspx page using the following code :
<%# GetRemainderInEscrow( (decimal)DataBinder.Eval(Container,
"DataItem.ApprovedAmount"), DataBinder.Eval(Container, "DataItem.Paid")
) %>
The code worked as it should. If you have control over the
'bs.getPriority' method, try allowing an object to be passed instead of
an integer value type. If that doesn't work. If that still does not
work, copy and paste the exact error message and Stack Trace.
Tod Birdsall, MCP
http://tod1d.blogspot.com

Strange problem

I have a class method which takes integer as parameter...when i call the
method as shown below i get this error message: Specified cast is not valid

<td><%# bs.getPriority((int)DataBinder.Eval(Container.Data Item,
"Priority"))%></td
When i print the DataItem "Priority" it shows an integer value, but for some
reason the method does not like value.. if i call this method like ->
bs.getPriortiy(3); it works fine.

In the database i have a field called "Priority" int type...

The method works fine when i call it in DataItemBound method..

any idea?Hi,

Try using

int.Parse(DataBinder.Eval(Container.DataItem, "Priority"))

DataBinder.Eval returns a string value type. (int) is used to
implicitly cast values to integers. Strings must be explicitly cast
using the Parse method.
Hope this helps.

Tod Birdsall, MCP
http://tod1d.blogspot.com
Tod thank you so much :) it worked..

still confused why one of them works not the other as shown below:
<TD><%# bs.getCampusName((int)DataBinder.Eval(Container.Da taItem,
"CampusID"))%></TD
<td><%# bs.getCampusName((int.Parse(DataBinder.Eval(Contai ner.DataItem,
"Priority")))%></td
both CampusID and Priority is same type of value..

Many Thanks again.

"Tod Birdsall" wrote:

> Hi,
> Try using
> int.Parse(DataBinder.Eval(Container.DataItem, "Priority"))
> DataBinder.Eval returns a string value type. (int) is used to
> implicitly cast values to integers. Strings must be explicitly cast
> using the Parse method.
> Hope this helps.
> Tod Birdsall, MCP
> http://tod1d.blogspot.com
>
Sorry that did not solve the problem... :( i am getting this error message
now:

The best overloaded method match for 'int.Parse(string)' has some invalid
arguments

"Tod Birdsall" wrote:

> Hi,
> Try using
> int.Parse(DataBinder.Eval(Container.DataItem, "Priority"))
> DataBinder.Eval returns a string value type. (int) is used to
> implicitly cast values to integers. Strings must be explicitly cast
> using the Parse method.
> Hope this helps.
> Tod Birdsall, MCP
> http://tod1d.blogspot.com
>
Acutally, DataBinder.Eval returns an object unless you pass a third
parameter, a format specifier, i.e.

DataBinder.Eval(Container.DataItem, "Priority", "{0:d}")

Otherwise you get an object reference back, in which case you could
use Convert.ToInt32

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

On Tue, 9 Nov 2004 07:38:03 -0800, "huzz"
<huzz@.discussions.microsoft.com> wrote:

>Sorry that did not solve the problem... :( i am getting this error message
>now:
>The best overloaded method match for 'int.Parse(string)' has some invalid
>arguments
>"Tod Birdsall" wrote:
>> Hi,
>>
>> Try using
>>
>> int.Parse(DataBinder.Eval(Container.DataItem, "Priority"))
>>
>> DataBinder.Eval returns a string value type. (int) is used to
>> implicitly cast values to integers. Strings must be explicitly cast
>> using the Parse method.
>> Hope this helps.
>>
>> Tod Birdsall, MCP
>> http://tod1d.blogspot.com
>>
>
Hi,

Scott is correct. Sorry for the mis-information.

I tried to reproduce your error message. I created a function in the
code behind like so:

protected string GetRemainderInEscrow(decimal approvedAmount, object
paidAmount)

I then called the method from the aspx page using the following code :

<%# GetRemainderInEscrow( (decimal)DataBinder.Eval(Container,
"DataItem.ApprovedAmount"), DataBinder.Eval(Container, "DataItem.Paid")
) %
The code worked as it should. If you have control over the
'bs.getPriority' method, try allowing an object to be passed instead of
an integer value type. If that doesn't work. If that still does not
work, copy and paste the exact error message and Stack Trace.
Tod Birdsall, MCP
http://tod1d.blogspot.com

Strange problem in sending emails by asp.net

I use the following code to send email, and strange thing that I received the message at hotmail mail, and failed to receive it at yahoo mail , can you help me and explain what this happen and how to overcome this.


Regards
Serag Farag
PrivateSub Button1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles Button1.Click

Dim msgmailAs System.Web.Mail.MailMessage

Dim SmtpMailAs System.Web.Mail.SmtpMail

msgmail =New System.Web.Mail.MailMessage

' SmtpMail =

msgmail.To = "elomah@dotnet.itags.org.yahoo.com"

msgmail.Cc = "ahmed_serageldin@dotnet.itags.org.hotmail.com"

msgmail.From = "ahmed_serageldin@dotnet.itags.org.hotmail.com"

msgmail.Subject = "subject of ggggggggggggggmsg"

msgmail.BodyFormat = System.Web.Mail.MailFormat.Html

msgmail.Body = " what u send mail ofgh ghgf ghr msgs"

SmtpMail.SmtpServer = "serag-0ivd22eow"

smtpmail.send(msgmail)

Response.Write("msg recived")

EndSub

Hello Serag and welcome to the forums.
First of all, if your email is received by Hotmail, then I don't thinkthere is a problem with your code. Maybe some wrong happened on its wayto Yahoo. Try to upload your script to a live server and then send theemail again.
Regards,


i saw the same problem in a diffirent thread i will check if i can find it for you but any way try what bilal suggest

try one of those links it might helps
http://forums.asp.net/916696/ShowPost.aspx
http://forums.asp.net/ShowPost.aspx?PageIndex=2&PostID=719622#719622
http://forums.asp.net/846879/ShowPost.aspx
and let me know if you solve it
good luck !!!