Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Wednesday, March 28, 2012

system.IO.File.Exists doesnt working for file that is outside my virtual directory

hi

i have file browser control to select any file and a button to upload
file on my web page now when i select any file. now on click of upload
button i have check that file exist or no

if system.IO.File.Exist(file path) then
...
end if
now when ever i choose file system.IO.File.Exist(file path) return
false, but if i select file from my virtual directory then only it
return true.

so how to select file from any folder on my PC and chech that it exist
or notIt may have to do with the ASP.net user in IIS not having read
permissions on the directories?

Max wrote:

Quote:

Originally Posted by

hi
>
i have file browser control to select any file and a button to upload
file on my web page now when i select any file. now on click of upload
button i have check that file exist or no
>
if system.IO.File.Exist(file path) then
...
end if
now when ever i choose file system.IO.File.Exist(file path) return
false, but if i select file from my virtual directory then only it
return true.
>
so how to select file from any folder on my PC and chech that it exist
or not


Are you using an absolute path or a relative path to the file?

"Max" wrote:

Quote:

Originally Posted by

hi
>
i have file browser control to select any file and a button to upload
file on my web page now when i select any file. now on click of upload
button i have check that file exist or no
>
if system.IO.File.Exist(file path) then
...
end if
now when ever i choose file system.IO.File.Exist(file path) return
false, but if i select file from my virtual directory then only it
return true.
>
so how to select file from any folder on my PC and chech that it exist
or not
>
>


followin is the error i am getting

Server Error in '/' Application.
------------------------

Access to the path
"L:\Webhosting\home.gujarat.gov.in\homeapps\imagefi les\images.jpg" is
denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the
path "L:\Webhosting\home.gujarat.gov.in\homeapps\imagefi les\images.jpg"
is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS
5 or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user
(typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in
Explorer, choose "Properties" and select the Security tab. Click "Add"
to add the appropriate user or group. Highlight the ASP.NET account,
and check the boxes for the desired access.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.

Stack Trace:

[UnauthorizedAccessException: Access to the path
"L:\Webhosting\home.gujarat.gov.in\homeapps\imagefi les\images.jpg" is
denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.File.Delete(String path) +165
CMSAPPS.mas_WMKD_entry.Save_ADD() in
D:\dnSource\HOMEAPPS_mahesh\mas_WMKD_entry.aspx.vb :248
CMSAPPS.mas_WMKD_entry.bttn_Save_Click(Object sender, EventArgs e)
in D:\dnSource\HOMEAPPS_mahesh\mas_WMKD_entry.aspx.vb :221
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1292
What do you not understand about the exception's explanation?

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?

"Max" <mahesh.anjani@.gmail.comwrote in message
news:1155306880.304856.71550@.i3g2000cwc.googlegrou ps.com...

Quote:

Originally Posted by

followin is the error i am getting
>
Server Error in '/' Application.
------------------------
>
Access to the path
"L:\Webhosting\home.gujarat.gov.in\homeapps\imagefi les\images.jpg" is
denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
>
Exception Details: System.UnauthorizedAccessException: Access to the
path "L:\Webhosting\home.gujarat.gov.in\homeapps\imagefi les\images.jpg"
is denied.
>
ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS
5 or Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user
(typically IUSR_MACHINENAME) or the authenticated request user.
>
To grant ASP.NET write access to a file, right-click the file in
Explorer, choose "Properties" and select the Security tab. Click "Add"
to add the appropriate user or group. Highlight the ASP.NET account,
and check the boxes for the desired access.
>
Source Error:
>
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
>
>
Stack Trace:
>
>
[UnauthorizedAccessException: Access to the path
"L:\Webhosting\home.gujarat.gov.in\homeapps\imagefi les\images.jpg" is
denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.File.Delete(String path) +165
CMSAPPS.mas_WMKD_entry.Save_ADD() in
D:\dnSource\HOMEAPPS_mahesh\mas_WMKD_entry.aspx.vb :248
CMSAPPS.mas_WMKD_entry.bttn_Save_Click(Object sender, EventArgs e)
in D:\dnSource\HOMEAPPS_mahesh\mas_WMKD_entry.aspx.vb :221
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
>
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1292
>

System.IO.Stream to resulting file.

I'm kicking myself as I've had this 'bug' before, and I cannot remember what it was that resolved it.

Essentially I'm re-writing my upload control, and its started exhibiting a weird 'corruption' thing.

Essentially I have this code:

Dim FileLenAs Integer = FileData.LengthDim FileDataByes(FileLen)As Byte' Initialize the stream.Dim ResourceStreamAs System.IO.Stream = FileData' Read the file into the byte array. ResourceStream.Read(FileDataByes, 0, FileLen)Dim SavingStreamAs System.IO.FileStream = _ System.IO.File.Create(Server.MapPath(Me.__VirtualPath & FileName))' Copy the byte array into a string.For iAs Integer = 0To FileLen - 1 SavingStream.WriteByte(FileDataByes(i).ToString())Next' Close the streams. ResourceStream.Close() SavingStream.Close()
FileData is a stream of the file, either from a server side file, or from a httppostedfile. The file appears to save ok, the size of the file is correct. And when checking the properties the byte count looks exactly the same.

But the file is quite obviously corrected, it wont open. I'm guessing the issue is to do with encoding. But I can't remember what I did to resolve it. I'm looking at my old framework and the code at this point is identical. Could it be something to do server settings changing the encoding of POSTS?

Pre-cheers.

Stevo.
Scratch that, its the literal 5 minutes after submitted a thread you realise your obvious mistake...

' Create the fragment.Dim FragmentAs String = _ Engine.Convert.ToHexString(FileData, 0, 2)
DOH! can't believe I forget to 'rewind' the stream after getting a fragment identifier...

Cheers anyways!

Monday, March 26, 2012

System.Net.Mail & sending emails with line breaks

Hi,

When a client sends an email via a web form (text entered in a asp:TextBox server control), the email received has no line breaks, and it is displayed in one line. This has bad impact on email readability... How can one overcome this probelm?

Thank you,

Alon

If you are sending mail text in simple text format then you have to use System.Environment.NewLine to move rest text in next line.

SmtpMail.SmtpServer = "1.0.0.127";
MailMessage mm = new MailMessage();
mm.From = "bill@.microsoft.com";
mm.To = "job@.apple.com";
mm.Subject = "";
mm.Body = "line 1" + System.Environment.NewLine + "line 2";


Hi,

Thank you for your reply.

I forgot to metion that the mail is sent in HTML format:

mailMessage.IsBodyHtml =true;

Am I supposed to parse the user's message (the text in the TextBox control), chck for CRLF (or is it \n) and replace it with System.Environment.NewLine? Isn't there some standard way to send the email, as i is in the text box (multiline text box. It looks like a text area)?

Thank you,

Alon


Here is the modified code for HTML formated body

mm.Body = "line 1" + "<br>" + "line 2";

Rest of the code will remain same.


But how can I know where line1 ends and line2 starts? All I have is a string I get form TextBox.Text. From this string I cannot deduce where did the user hit return - it's a "flat" string.

A word about he context of this: this web form is a "Contact Us" page. The TextBox is a multiline text box, which serves as a free text input field.

Thank you,

Alon


As what Firoz said, you have to use the "<br />"

You will use the following code to replace each line in your textbox to break

Replace(textbox1.text, vbCrLf,"<br />")

HTH
Regards


Oooops, now I understand. It works. I thank the both of you.

Alon

Thursday, March 22, 2012

System.OverflowException during IPostBackDataHandler.LoadPostData

During my postbacks, I try to assign the value from an Input tag to a
property of a custom control. However, I keep recieving the following error:

An exception of type 'System.OverflowException' occurred in
Microsoft.VisualBasic.dll but was not handled in user code
Additional information: Arithmetic operation resulted in an overflow.

The code that it highlights during this error is the 2nd line of the
following (Me.Value = postCollection(Me.ID & "_currvalue")):

Public Function LoadPostData(ByVal postDataKey As String, ByVal
postCollection As NameValueCollection) As Boolean Implements
IPostBackDataHandler.LoadPostData
Me.Value = postCollection(Me.ID & "_currvalue")
Return True
End Function

I will admit that this is my first time using the IPostBackDataHandler
interface, but 'System.OverflowException' seems like a very strange
exception for this part of my code, since I am just doing a String
concatenation and an assignment. The value associated with this
postCollection key is a positive integer (well, a string actually, but it
has no negative signs or decimal places, just a couple digits) and Me.Value
is a Property of my Control that is of type Integer, so it shouldn't have
any problem converting, right? If anybody has any ideas as to where I might
be going wrong here, or where I could look to help find the problem, I would
appreciate it. Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/What does the Value property and RaisePostDataChanged method (another method
of IPostBackDataHandler) look like? If the code isn't long oner, post entire
control's sources.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Nathan Sokalski" <njsokalski@.hotmail.comwrote in message
news:%23cRbMd8qGHA.1140@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

During my postbacks, I try to assign the value from an Input tag to a
property of a custom control. However, I keep recieving the following
error:
>
>
An exception of type 'System.OverflowException' occurred in
Microsoft.VisualBasic.dll but was not handled in user code
Additional information: Arithmetic operation resulted in an overflow.
>
>
The code that it highlights during this error is the 2nd line of the
following (Me.Value = postCollection(Me.ID & "_currvalue")):
>
>
Public Function LoadPostData(ByVal postDataKey As String, ByVal
postCollection As NameValueCollection) As Boolean Implements
IPostBackDataHandler.LoadPostData
Me.Value = postCollection(Me.ID & "_currvalue")
Return True
End Function
>
>
I will admit that this is my first time using the IPostBackDataHandler
interface, but 'System.OverflowException' seems like a very strange
exception for this part of my code, since I am just doing a String
concatenation and an assignment. The value associated with this
postCollection key is a positive integer (well, a string actually, but it
has no negative signs or decimal places, just a couple digits) and
Me.Value is a Property of my Control that is of type Integer, so it
shouldn't have any problem converting, right? If anybody has any ideas as
to where I might be going wrong here, or where I could look to help find
the problem, I would appreciate it. Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
>


Here is the code for the Value property:

<Description("The value that the Slider is currently set to")>
<DefaultValue("0")_
Public Property Value() As Integer
Get
If IsNothing(ViewState("value")) Then Return 0 Else Return
ViewState("value")
End Get
Set(ByVal value As Integer)
ViewState("value") = value
End Set
End Property

And here is the code for the RaisePostDataChangedEvent method:

Public Sub RaisePostDataChangedEvent() Implements
IPostBackDataHandler.RaisePostDataChangedEvent
End Sub

The only code in my OnPreRender method other than the creating of the
client-side scripts, which I do using String concatenation and the
Page.ClientScript.RegisterClientScriptBlock method, is setting the only
global variable I have, which is declared as Private pixeltovalue As
Decimal, as follows:

Me.pixeltovalue = (Me.Width - 48) / (Me.MaxValue - Me.MinValue)

My Render method just uses the basic methods of the HtmlTextWriter class.
The only arithmetic operations in my OnPreRender and Render methods are very
simple addition, subtraction, multiplication, and division. I did not think
it was worth pasting all my code into this message (although I can if you
really think it will help you solve the problem), since almost all of it is
property declarations, all of which look exactly the same as the one above,
String concatenation while building the JavaScript functions, and the basic
HtmlTextWriter methods used to create the html tags; the only other code in
my control is the IPostBackDataHandler implementation and the
Me.pixeltovalue declaration and assignment that I showed above. Any ideas as
to what the problem might be? Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"Teemu Keiski" <joteke@.aspalliance.comwrote in message
news:Oblpjg9qGHA.4516@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

What does the Value property and RaisePostDataChanged method (another
method of IPostBackDataHandler) look like? If the code isn't long oner,
post entire control's sources.
>
>
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
>
>
>
"Nathan Sokalski" <njsokalski@.hotmail.comwrote in message
news:%23cRbMd8qGHA.1140@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>During my postbacks, I try to assign the value from an Input tag to a
>property of a custom control. However, I keep recieving the following
>error:
>>
>>
>An exception of type 'System.OverflowException' occurred in
>Microsoft.VisualBasic.dll but was not handled in user code
>Additional information: Arithmetic operation resulted in an overflow.
>>
>>
>The code that it highlights during this error is the 2nd line of the
>following (Me.Value = postCollection(Me.ID & "_currvalue")):
>>
>>
>Public Function LoadPostData(ByVal postDataKey As String, ByVal
>postCollection As NameValueCollection) As Boolean Implements
>IPostBackDataHandler.LoadPostData
> Me.Value = postCollection(Me.ID & "_currvalue")
> Return True
>End Function
>>
>>
>I will admit that this is my first time using the IPostBackDataHandler
>interface, but 'System.OverflowException' seems like a very strange
>exception for this part of my code, since I am just doing a String
>concatenation and an assignment. The value associated with this
>postCollection key is a positive integer (well, a string actually, but it
>has no negative signs or decimal places, just a couple digits) and
>Me.Value is a Property of my Control that is of type Integer, so it
>shouldn't have any problem converting, right? If anybody has any ideas as
>to where I might be going wrong here, or where I could look to help find
>the problem, I would appreciate it. Thanks.
>--
>Nathan Sokalski
>njsokalski@.hotmail.com
>http://www.nathansokalski.com/
>>


>
>


Hi,

could it be that the

Me.Value = postCollection(Me.ID & "_currvalue")

would be so big number it doesn't fit to the value? (32-bit Integer). Where
does this value come from? Is it calculated, entered by user?

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Nathan Sokalski" <njsokalski@.hotmail.comwrote in message
news:OWsfabErGHA.3856@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

Here is the code for the Value property:
>
>
<Description("The value that the Slider is currently set to")>
<DefaultValue("0")_
Public Property Value() As Integer
Get
If IsNothing(ViewState("value")) Then Return 0 Else Return
ViewState("value")
End Get
Set(ByVal value As Integer)
ViewState("value") = value
End Set
End Property
>
>
And here is the code for the RaisePostDataChangedEvent method:
>
>
Public Sub RaisePostDataChangedEvent() Implements
IPostBackDataHandler.RaisePostDataChangedEvent
End Sub
>
>
The only code in my OnPreRender method other than the creating of the
client-side scripts, which I do using String concatenation and the
Page.ClientScript.RegisterClientScriptBlock method, is setting the only
global variable I have, which is declared as Private pixeltovalue As
Decimal, as follows:
>
>
Me.pixeltovalue = (Me.Width - 48) / (Me.MaxValue - Me.MinValue)
>
>
My Render method just uses the basic methods of the HtmlTextWriter class.
The only arithmetic operations in my OnPreRender and Render methods are
very simple addition, subtraction, multiplication, and division. I did not
think it was worth pasting all my code into this message (although I can
if you really think it will help you solve the problem), since almost all
of it is property declarations, all of which look exactly the same as the
one above, String concatenation while building the JavaScript functions,
and the basic HtmlTextWriter methods used to create the html tags; the
only other code in my control is the IPostBackDataHandler implementation
and the Me.pixeltovalue declaration and assignment that I showed above.
Any ideas as to what the problem might be? Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
>
"Teemu Keiski" <joteke@.aspalliance.comwrote in message
news:Oblpjg9qGHA.4516@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>What does the Value property and RaisePostDataChanged method (another
>method of IPostBackDataHandler) look like? If the code isn't long oner,
>post entire control's sources.
>>
>>
>--
>Teemu Keiski
>ASP.NET MVP, AspInsider
>Finland, EU
>http://blogs.aspadvice.com/joteke
>>
>>
>>
>"Nathan Sokalski" <njsokalski@.hotmail.comwrote in message
>news:%23cRbMd8qGHA.1140@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>>During my postbacks, I try to assign the value from an Input tag to a
>>property of a custom control. However, I keep recieving the following
>>error:
>>>
>>>
>>An exception of type 'System.OverflowException' occurred in
>>Microsoft.VisualBasic.dll but was not handled in user code
>>Additional information: Arithmetic operation resulted in an overflow.
>>>
>>>
>>The code that it highlights during this error is the 2nd line of the
>>following (Me.Value = postCollection(Me.ID & "_currvalue")):
>>>
>>>
>>Public Function LoadPostData(ByVal postDataKey As String, ByVal
>>postCollection As NameValueCollection) As Boolean Implements
>>IPostBackDataHandler.LoadPostData
>> Me.Value = postCollection(Me.ID & "_currvalue")
>> Return True
>>End Function
>>>
>>>
>>I will admit that this is my first time using the IPostBackDataHandler
>>interface, but 'System.OverflowException' seems like a very strange
>>exception for this part of my code, since I am just doing a String
>>concatenation and an assignment. The value associated with this
>>postCollection key is a positive integer (well, a string actually, but
>>it has no negative signs or decimal places, just a couple digits) and
>>Me.Value is a Property of my Control that is of type Integer, so it
>>shouldn't have any problem converting, right? If anybody has any ideas
>>as to where I might be going wrong here, or where I could look to help
>>find the problem, I would appreciate it. Thanks.
>>--
>>Nathan Sokalski
>>njsokalski@.hotmail.com
>>http://www.nathansokalski.com/
>>>


>>
>>


>
>


No, that was not the problem, but I found that in my client-side JavaScript
I needed to explicitly convert a text value to a Number, I was ending up
with a value like "25-1" being sent to the server instead of 24, but thanks
for your help anyway.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"Teemu Keiski" <joteke@.aspalliance.comwrote in message
news:ObNfoyJrGHA.4504@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Hi,
>
could it be that the
>
Me.Value = postCollection(Me.ID & "_currvalue")
>
would be so big number it doesn't fit to the value? (32-bit Integer).
Where does this value come from? Is it calculated, entered by user?
>
>
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
>
>
>
"Nathan Sokalski" <njsokalski@.hotmail.comwrote in message
news:OWsfabErGHA.3856@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>Here is the code for the Value property:
>>
>>
><Description("The value that the Slider is currently set to")>
><DefaultValue("0")_
>Public Property Value() As Integer
> Get
> If IsNothing(ViewState("value")) Then Return 0 Else Return
>ViewState("value")
> End Get
> Set(ByVal value As Integer)
> ViewState("value") = value
> End Set
>End Property
>>
>>
>And here is the code for the RaisePostDataChangedEvent method:
>>
>>
>Public Sub RaisePostDataChangedEvent() Implements
>IPostBackDataHandler.RaisePostDataChangedEvent
>End Sub
>>
>>
>The only code in my OnPreRender method other than the creating of the
>client-side scripts, which I do using String concatenation and the
>Page.ClientScript.RegisterClientScriptBlock method, is setting the only
>global variable I have, which is declared as Private pixeltovalue As
>Decimal, as follows:
>>
>>
>Me.pixeltovalue = (Me.Width - 48) / (Me.MaxValue - Me.MinValue)
>>
>>
>My Render method just uses the basic methods of the HtmlTextWriter class.
>The only arithmetic operations in my OnPreRender and Render methods are
>very simple addition, subtraction, multiplication, and division. I did
>not think it was worth pasting all my code into this message (although I
>can if you really think it will help you solve the problem), since almost
>all of it is property declarations, all of which look exactly the same as
>the one above, String concatenation while building the JavaScript
>functions, and the basic HtmlTextWriter methods used to create the html
>tags; the only other code in my control is the IPostBackDataHandler
>implementation and the Me.pixeltovalue declaration and assignment that I
>showed above. Any ideas as to what the problem might be? Thanks.
>--
>Nathan Sokalski
>njsokalski@.hotmail.com
>http://www.nathansokalski.com/
>>
>"Teemu Keiski" <joteke@.aspalliance.comwrote in message
>news:Oblpjg9qGHA.4516@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>>What does the Value property and RaisePostDataChanged method (another
>>method of IPostBackDataHandler) look like? If the code isn't long oner,
>>post entire control's sources.
>>>
>>>
>>--
>>Teemu Keiski
>>ASP.NET MVP, AspInsider
>>Finland, EU
>>http://blogs.aspadvice.com/joteke
>>>
>>>
>>>
>>"Nathan Sokalski" <njsokalski@.hotmail.comwrote in message
>>news:%23cRbMd8qGHA.1140@.TK2MSFTNGP05.phx.gbl...
>>>During my postbacks, I try to assign the value from an Input tag to a
>>>property of a custom control. However, I keep recieving the following
>>>error:
>>>>
>>>>
>>>An exception of type 'System.OverflowException' occurred in
>>>Microsoft.VisualBasic.dll but was not handled in user code
>>>Additional information: Arithmetic operation resulted in an overflow.
>>>>
>>>>
>>>The code that it highlights during this error is the 2nd line of the
>>>following (Me.Value = postCollection(Me.ID & "_currvalue")):
>>>>
>>>>
>>>Public Function LoadPostData(ByVal postDataKey As String, ByVal
>>>postCollection As NameValueCollection) As Boolean Implements
>>>IPostBackDataHandler.LoadPostData
>>> Me.Value = postCollection(Me.ID & "_currvalue")
>>> Return True
>>>End Function
>>>>
>>>>
>>>I will admit that this is my first time using the IPostBackDataHandler
>>>interface, but 'System.OverflowException' seems like a very strange
>>>exception for this part of my code, since I am just doing a String
>>>concatenation and an assignment. The value associated with this
>>>postCollection key is a positive integer (well, a string actually, but
>>>it has no negative signs or decimal places, just a couple digits) and
>>>Me.Value is a Property of my Control that is of type Integer, so it
>>>shouldn't have any problem converting, right? If anybody has any ideas
>>>as to where I might be going wrong here, or where I could look to help
>>>find the problem, I would appreciate it. Thanks.
>>>--
>>>Nathan Sokalski
>>>njsokalski@.hotmail.com
>>>http://www.nathansokalski.com/
>>>>
>>>
>>>


>>
>>


>
>

Tuesday, March 13, 2012

System.Resources.MissingManifestResourceException: How to edit .resources file

I downladed skmMenu ( a 3rd party menu) for ASP.NET application and I have made skmmenu.dll . After that I putmenu control on my webform, and start my application.I get the following error in browser. I guess this is a library issue!! Can somebody help.

Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "Menu.resources" was correctly embedded or linked into assembly "SkyMenu". baseName: Menu locationInfo: skmMenu.Menu resource file name: Menu.resources assembly: SkyMenu, Version=2.2.2078.30514, Culture=neutral, PublicKeyToken=null

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "Menu.resources" was correctly embedded or linked into assembly "SkyMenu". baseName: Menu locationInfo: skmMenu.Menu resource file name: Menu.resources assembly: SkyMenu, Version=2.2.2078.30514, Culture=neutral, PublicKeyToken=null
Source Error:
Line 1286:// If you are working on the skmMenu code base, this is in Menu.resx...Line 1287:ResourceManager manager = new ResourceManager( this.GetType() );Line 1288:script = manager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true).GetString("ClientScript");Line 1289:}Line 1290:this.Page.RegisterClientScriptBlock("skmMenu", script );
You need the Menu.resx file included in the dll's Project/Solution.
NC...

No Luck. Still getting same error.

Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "Menu.resources" was correctly embedded or linked into assembly "SkyMenu". baseName: Menu locationInfo: skmMenu.Menu resource file name: Menu.resources assembly: SkyMenu, Version=2.2.2081.16098, Culture=neutral, PublicKeyToken=null

System.Security.SecurityException: That assembly does not allow

I have created an ActiveX control that does word automation. Once I
creat an instance of work I get the following message
System.Security.SecurityException: That assembly does not allow
partially trusted callers.
I am using .net 2. I have a key and use the regasm tool after it the
dll is compiled
I am really lost on how to make this work any help will be appreciated
JohnDid this work for you?
I have a .NET class that i have made com visible and the client is
trying to access it using Visual Objects over a network shar and is
getting the same exception.
i have added the AllowPartiallyTusterCallers attribute to my
assemblyinfo.cs but is hasnt fixed it.
i have ben trying to test using something non .NET (VB 6.0) but i cant
even reference the tlb or dll but i think that is a VB 6.0 issue.
if anyone has any suggestions pleae let me know.
the Client has advised that the dll works if it is copied locally.
thanks

System.Security.SecurityException: That assembly does not allowpartially trusted callers.

I have created an ActiveX control that does word automation. Once I
creat an instance of work I get the following message
System.Security.SecurityException: That assembly does not allow
partially trusted callers.

I am using .net 2. I have a key and use the regasm tool after it the
dll is compiled

I am really lost on how to make this work any help will be appreciated

Johnyou prolly have to add this to your code:

[assembly: AllowPartiallyTrustedCallers]

--
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

Quote:

Originally Posted by

I have created an ActiveX control that does word automation. Once I
creat an instance of work I get the following message
System.Security.SecurityException: That assembly does not allow
partially trusted callers.
>
I am using .net 2. I have a key and use the regasm tool after it the
dll is compiled
>
I am really lost on how to make this work any help will be appreciated
>
John
>