Question Object variable or With block variable not set

razinkac

New member
Joined
Jul 7, 2013
Messages
3
Programming Experience
Beginner
this is my Income.aspx

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Income.aspx.vb"Inherits="iplapp.Income"%>
<!DOCTYPE html>

and here my Income.aspx.vb

vb[COLOR=#333333]][/COLOR][COLOR=#000088]Namespace iplapp
Public Class Income
Inherits System.Web.UI.Page
Private strCon As String="Data Source=alopex;Integrated Security=true;Initial Catalog=iplmaster;Persist Security Info=True"
Dim sql_statement As Object
Dim ViewBag As Object
End Namespace[/COLOR][COLOR=#333333][/xcode[/COLOR][COLOR=#333333]][/COLOR][COLOR=#000088]
[/COLOR][COLOR=#434343][FONT=helvetica]
then here the result

Object variable or With block variable not set ~> ViewBag.uploader = System.Web.HttpContext.Current.User.Identity.Name.ToString()
big thanks for answer

[/FONT][/COLOR]
 
Last edited:
Please don't post code as a bulleted list as it's very hard to read. If it's VB code then post it as plain text [xcode=vb]like this[/xcode] and if it's any other code then post it as plain text [code]like this[/code]. The advanced editor provides buttons for both or you can just type them by hand.

As for the question, there's no indication that you ever assign anything to 'ViewBag' so there's no indication that you should be able to get a member named 'uploader' from it.
 
I have removed your second post because it contained large amounts of irrelevant code. Not only that, you ignored my specific request to post code in appropriate formatting tags. If you want people to read your code then please take the couple of seconds required to format it to make it easily readable.

As for the question, I'm not quite sure why you need "another way" because I'm not really sure what you're doing exactly. I wasn't about to wade through all your code to find the relevant part and I'm quite sure that there are plenty of examples around of uploading files using Web Forms. The topic of this thread has been addressed so if you want to ask a question on a new topic then you should start a new thread dedicated to that topic. If you do so, please only relevant code and please post it formatted as I have requested.
 
Back
Top